Skip to content

Commit

Permalink
fix catalog tests
Browse files Browse the repository at this point in the history
  • Loading branch information
imadbourouche committed Feb 21, 2025
1 parent 11eee64 commit 14a268b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class SemanticArtefactCatalog < LinkedData::Models::Base
define_method(handler) { calculate_attr_from_metrics(mapped_to) }
end

serialize_default :acronym, :title, :color, :description, :logo, :fundedBy, :versionInfo, :homepage, :numberOfArtefacts, :federated_portals
serialize_default :acronym, :title, :color, :description, :logo, :fundedBy, :versionInfo, :homepage, :federated_portals

def ontologies_count
LinkedData::Models::Ontology.where(viewingRestriction: 'public').count
Expand Down Expand Up @@ -186,6 +186,10 @@ def get_services
end
end

def self.load_computed_attributes
LinkedData::Models::SemanticArtefactCatalog.attributes(:handler)
end

def self.valid_hash_code(inst, attr)
inst.bring(attr) if inst.bring?(attr)
str = inst.send(attr)
Expand Down
4 changes: 2 additions & 2 deletions test/models/mod/test_artefact_catalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ def test_create_artefact_catalog

def test_goo_attrs_to_load
all_attrs = LinkedData::Models::SemanticArtefactCatalog.goo_attrs_to_load([:all])
assert_equal LinkedData::Models::SemanticArtefactCatalog.attributes(:all), all_attrs
assert_equal LinkedData::Models::SemanticArtefactCatalog.attributes, all_attrs

default_attrs = LinkedData::Models::SemanticArtefactCatalog.goo_attrs_to_load([])
assert_equal [:acronym, :title, :color, :description, :logo, :fundedBy, :versionInfo, :homepage, :numberOfArtefacts, :federated_portals], default_attrs
assert_equal [:acronym, :title, :color, :description, :logo, :fundedBy, :versionInfo, :homepage, :federated_portals], default_attrs

specified_attrs = LinkedData::Models::SemanticArtefactCatalog.goo_attrs_to_load([:acronym, :title, :keyword, :featureList])
assert_equal [:acronym, :title, :keyword, :featureList], specified_attrs
Expand Down

0 comments on commit 14a268b

Please sign in to comment.