"""Functional tests for getting publishing obligation for tracks in product. Test endpoint: GET /product//tracks/publishing-obligation """ import json from oto import status as response_code from tests.testutils import db @db.test_schema_no_seed def test_get_tracks_publishing_obligation_data_for_product( client_get_tracks_pub_obl_for_product, tds_get_pub_obl): """Test get all tracks is successful.""" tds = tds_get_pub_obl db.merge_model_objects(tds['seed_data']) res = client_get_tracks_pub_obl_for_product(tds['product_id']) res_body = json.loads(res.data.decode()) assert res.status_code == response_code.OK tds['validate_response_message'](res_body) @db.test_schema_no_seed def test_get_tracks_publishing_obligation_data_for_empty_product( client_get_tracks_pub_obl_for_product): """Test validate tracks by product id is successful.""" res = client_get_tracks_pub_obl_for_product(product_id=1) assert res.status_code == response_code.OK res_body = json.loads(res.data.decode()) assert 'items' in res_body assert len(res_body['items']) == 0