Skip to content

Commit

Permalink
add detach a view from an ontology test
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Oct 12, 2023
1 parent a5f0c71 commit 2771484
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/controllers/test_ontologies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,32 @@ def test_download_acl_only
end


def test_detach_a_view
view = Ontology.find(@@view_acronym).include(:viewOf).first
ont = view.viewOf
refute_nil view
refute_nil ont

remove_view_of = {viewOf: ''}
patch "/ontologies/#{@@view_acronym}", MultiJson.dump(remove_view_of), "CONTENT_TYPE" => "application/json"

assert last_response.status == 204

get "/ontologies/#{@@view_acronym}"
onto = MultiJson.load(last_response.body)
assert_nil onto["viewOf"]


add_view_of = {viewOf: @@acronym}
patch "/ontologies/#{@@view_acronym}", MultiJson.dump(add_view_of), "CONTENT_TYPE" => "application/json"

assert last_response.status == 204

get "/ontologies/#{@@view_acronym}"
onto = MultiJson.load(last_response.body)
assert_equal onto["viewOf"], ont.id.to_s
end

private

def check400(response)
Expand Down

0 comments on commit 2771484

Please sign in to comment.