Split api relation show/full tests

This commit is contained in:
Anton Khorev 2025-02-01 15:13:09 +03:00
parent 9ef7f3a2e7
commit 0c893e9197

View file

@ -122,29 +122,33 @@ module Api
# Test showing relations. # Test showing relations.
# ------------------------------------- # -------------------------------------
def test_show def test_show_not_found
# check that a visible relation is returned properly
get api_relation_path(create(:relation))
assert_response :success
# check that an invisible relation is not returned
get api_relation_path(create(:relation, :deleted))
assert_response :gone
# check chat a non-existent relation is not returned
get api_relation_path(0) get api_relation_path(0)
assert_response :not_found assert_response :not_found
end end
def test_full def test_show_deleted
# check the "full" mode get api_relation_path(create(:relation, :deleted))
get relation_full_path(:id => 999999)
assert_response :not_found
get relation_full_path(:id => create(:relation, :deleted).id)
assert_response :gone assert_response :gone
end
get relation_full_path(:id => create(:relation).id) def test_show
get api_relation_path(create(:relation))
assert_response :success
end
def test_full_not_found
get relation_full_path(999999)
assert_response :not_found
end
def test_full_deleted
get relation_full_path(create(:relation, :deleted))
assert_response :gone
end
def test_full_empty
get relation_full_path(create(:relation))
assert_response :success assert_response :success
# FIXME: check whether this contains the stuff we want! # FIXME: check whether this contains the stuff we want!
end end