Skip to content

Commit

Permalink
add class tree test with scheme and collection filters
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Oct 17, 2023
1 parent d0667aa commit 11e7729
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/controllers/test_schemes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,22 @@ def test_calls_not_found
assert_equal 404, last_response.status
end


def test_class_tree
ont = Ontology.find('INRAETHES-0').include(:acronym).first
sub = ont.latest_submission
concept_schemes = ["http://opendata.inrae.fr/thesaurusINRAE/domainesINRAE"]
sub.bring_remaining
sub.uri = RDF::URI.new('http://opendata.inrae.fr/thesaurusINRAE/domainesINRAE')
sub.hasOntologyLanguage = LinkedData::Models::OntologyFormat.find('SKOS').first
sub.save

cls = 'http://opendata.inrae.fr/thesaurusINRAE/d_6'
get "ontologies/INRAETHES-0/classes/#{CGI.escape(cls)}/tree?concept_schemes=#{concept_schemes.join(',')}&concept_collections=#{concept_schemes.join(',')}"

classes = MultiJson.load(last_response.body)

refute_nil classes.select{|x| x['@id'].eql?(cls)}.first['isInActiveScheme']
refute_nil classes.select{|x| x['@id'].eql?(cls)}.first['isInActiveCollection']
end
end

0 comments on commit 11e7729

Please sign in to comment.