Skip to content

Commit

Permalink
KBMBF-452: #37 Show ratio of oer-content
Browse files Browse the repository at this point in the history
KBMBF-502: Improving frontend
SD_WLO-238: Showing OER

Fixing unit tests
  • Loading branch information
Robert Meissner committed Jul 21, 2022
1 parent 76cf41b commit c501d15
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
19 changes: 9 additions & 10 deletions tests/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import pytest

from app.api.analytics.analytics import CollectionValidationStats
from app.api.analytics.models import Collection
from app.api.analytics.stats import (
Row,
Expand Down Expand Up @@ -119,7 +120,7 @@ def test_build_material_search():
"properties.cclom:general_description",
"content.fulltext",
"i18n.de_DE.ccm:taxonid",
"i18n.de_DE.ccm:oeh_lrt_aggregated",
"i18n.de_DE.ccm:oeh_lrt",
"i18n.de_DE.ccm:educationalcontext",
"i18n.de_DE.ccm:educationalintendedenduserrole",
],
Expand All @@ -133,7 +134,7 @@ def test_build_material_search():
"terms": {
"missing": "N/A",
"size": 500000,
"field": "properties.ccm:oeh_lrt_aggregated.keyword",
"field": "properties.ccm:oeh_lrt.keyword",
}
}
},
Expand Down Expand Up @@ -215,12 +216,9 @@ def _get_item(_, key):

assert len(result) == 1
assert result[0].noderef_id == uuid.UUID("f3dc9ea1-d608-4b4e-a78c-98063a3e8461")
assert result[0].validation_stats == {
"title": None,
"keywords": ["missing"],
"description": ["missing"],
"edu_context": ["missing"],
}
assert result[0].validation_stats == CollectionValidationStats(
title=None, description=["missing"], edu_context=["missing"]
)


def test_materials_with_missing_properties():
Expand Down Expand Up @@ -260,5 +258,6 @@ def _get_item(_, key):
assert len(result) == 1
assert result[0].noderef_id == uuid.UUID("f3dc9ea1-d608-4b4e-a78c-98063a3e8461")
dummy_material_node = uuid.UUID("263afc5b-6445-4a5a-b014-a77f1db473b9")
assert result[0].validation_stats.ads_qualifier.missing == [dummy_material_node]
assert result[0].validation_stats.object_type is None
print(result[0].validation_stats)
assert result[0].validation_stats.publisher.missing == [dummy_material_node]
assert result[0].validation_stats.material_type is None
16 changes: 8 additions & 8 deletions tests/unit_tests/crud/test_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,16 @@ def test_score_search_material():

expected_search = {
"aggs": {
"missing_ads_qualifier": {
"missing": {"field": "properties.ccm:containsAdvertisement.keyword"}
},
"missing_description": {
"missing": {"field": "properties.cclom:general_description.keyword"}
},
"missing_edu_context": {
"missing": {"field": "properties.ccm:educationalcontext.keyword"}
},
"missing_keywords": {
"missing": {"field": "properties.cclom:general_keyword.keyword"}
"missing_intended_end_user_role": {
"missing": {
"field": "i18n.de_DE.ccm:educationalintendedenduserrole.keyword"
}
},
"missing_license": {
"filter": {
Expand Down Expand Up @@ -126,15 +125,16 @@ def test_score_search_material():
}
},
"missing_material_type": {
"missing": {"field": "properties.ccm:oeh_lrt_aggregated.keyword"}
"missing": {"field": "properties.ccm:oeh_lrt.keyword"}
},
"missing_object_type": {
"missing": {"field": "properties.ccm:objecttype.keyword"}
"missing_publisher": {
"missing": {"field": "properties.ccm:oeh_publisher_combined.keyword"}
},
"missing_subjects": {
"missing": {"field": "properties.ccm:taxonid.keyword"}
},
"missing_title": {"missing": {"field": "properties.cclom:title.keyword"}},
"missing_url": {"missing": {"field": "properties.ccm:wwwurl.keyword"}},
},
"query": {
"bool": {
Expand Down

0 comments on commit c501d15

Please sign in to comment.