Skip to content

Commit

Permalink
save category and fetch it in test parent category
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilelkihal committed Oct 10, 2024
1 parent 3afae26 commit 40c5444
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ gem 'ncbo_cron', git: 'https://github.com/ontoportal-lirmm/ncbo_cron.git', branc
gem 'ncbo_ontology_recommender', git: 'https://github.com/ncbo/ncbo_ontology_recommender.git', branch: 'master'
gem 'goo', github: 'ontoportal-lirmm/goo', branch: 'development'
gem 'sparql-client', github: 'ontoportal-lirmm/sparql-client', branch: 'development'
gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'feature/parent-category-list'
gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'development'

group :development do
# bcrypt_pbkdf and ed35519 is required for capistrano deployments when using ed25519 keys; see https://github.com/miloserdow/capistrano-deploy/issues/42
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ GIT

GIT
remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git
revision: ce7463428dbee569a0ca4ca20fe84861e4a2ce82
branch: feature/parent-category-list
revision: 25819bc9bff2313a9ac4fc717241d37051bcdf4f
branch: development
specs:
ontologies_linked_data (0.0.1)
activesupport
Expand Down
11 changes: 9 additions & 2 deletions test/controllers/test_categories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,27 @@ def test_parent_category
name: "Parent Category 1",
description: "Description for Parent Category 1."
)
parent_category1.save

parent_category2 = LinkedData::Models::Category.new(
acronym: "PARENT2",
name: "Parent Category 2",
description: "Description for Parent Category 2."
)
parent_category2.save

category_instance = LinkedData::Models::Category.new(
acronym: "CAT123",
name: "Sample Category",
description: "This is a sample category.",
parentCategory: [parent_category1, parent_category2]
)
assert_equal category_instance.parentCategory.first , parent_category1
assert_equal category_instance.parentCategory.last , parent_category2
category_instance.save

get '/categories/CAT123'
fetched_category = MultiJson.load(last_response.body)

assert_equal fetched_category["parentCategory"].first , parent_category1.id.to_s
assert_equal fetched_category["parentCategory"].last , parent_category2.id.to_s
end
end

0 comments on commit 40c5444

Please sign in to comment.