File size: 1,364 Bytes
3685d4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from __future__ import annotations

import app


def test_subject_result_includes_all_field_quartiles(monkeypatch):
    monkeypatch.setattr(app, "lookup_any", lambda _issns: {
        "matched_issn": "1234-5678",
        "quartile": "Q1",
        "h_index": "88",
        "publisher": "Example Publisher",
        "open_access": "Yes",
        "country": "UAE",
        "categories": "Engineering (Q1); Energy (Q2)",
        "sourceid": "999",
        "quartiles_by_field": [
            {"code": "2201", "field": "Engineering", "quartile": "Q1"},
            {"code": "2102", "field": "Energy", "quartile": "Q2"},
        ],
        "state": "indexed_ranked",
        "currently_indexed": True,
        "warn": False,
    })
    monkeypatch.setattr(app, "build_verify_links", lambda *_args: {"scimago": "https://example.test"})
    monkeypatch.setattr(app, "is_ku_apc_covered", lambda *_args: False)

    result = app.build_subject_journal_result({
        "title": "Example Journal",
        "issn": "1234-5678",
        "quartile": "Q1",
        "h_index": 80,
    })
    assert result["quartile"] == "Q1"
    assert result["quartiles_by_field"] == [
        {"code": "2201", "field": "Engineering", "quartile": "Q1"},
        {"code": "2102", "field": "Energy", "quartile": "Q2"},
    ]
    assert result["h_index"] == 88