"""Test get_conversion_body function.""" import json from territories.db import db_init def test_get_conversion_body( db_fixture, fixture_client, header_fixture, iso_standard, orch_standard): """Test that conversion results include the expected properties.""" db_init.data_backfill() country_code = 'RS' expected_data = { 'territory_code_numeric': 891, 'territory_code_a2': 'CS', 'orch_id': 190, 'territory_name': 'Serbia and Montenegro', 'territory_code_a3': 'SCG', 'continent': 'Europe', 'standard': 'Orch_1_2016'} conversion_response = fixture_client.get( '/conversion/{}/{}?territory_code_a2={}'.format( iso_standard, orch_standard, country_code), headers=header_fixture) response_json = json.loads(conversion_response.data.decode('utf-8')) assert response_json.get('items') == [expected_data]