"""Integration tests for GET /contract/.""" import pytest import requests from abacus_contract.tests.integration.consts import api, constants from abacus_contract.tests.integration.utils import generic_helper @pytest.mark.jira('PLATFORM-4469') def test_get_contract_by_id(auth_headers: dict[str, str]) -> None: """Test GET /contract/.""" contract_id, contract_body, _ = generic_helper.create_account_and_contract( account_id=constants.TEST_ACCOUNT_ID ) res = requests.get( f'{api.QA_BASE_URL}/contract/{contract_id}', headers=auth_headers, ) assert res.status_code == 200 body = res.json() for key, value in contract_body.items(): assert body[key] == value @pytest.mark.jira('PLATFORM-4469') def test_get_contract_by_id_unauthorized(unauthorized_headers: dict[str, str]) -> None: """Test GET /contract/ with unauthorized user.""" contract_id, _, _ = generic_helper.create_account_and_contract() res = requests.get( f'{api.QA_BASE_URL}/contract/{contract_id}', headers=unauthorized_headers, ) assert res.status_code == 403 assert res.json()['message'] == 'User is forbidden' def test_get_contract_can_be_deleted(auth_headers: dict[str, str]) -> None: """Test GET /contract//can-be-deleted.""" contract_id, _, _ = generic_helper.create_account_and_contract( account_id=constants.TEST_ACCOUNT_ID ) res = requests.get( f'{api.QA_BASE_URL}/contract/{contract_id}/can-be-deleted', headers=auth_headers, ) assert res.status_code == 200