"""Integration Tests for ows-sales-goals.""" from os import getenv from sales_goals import features def test_upsert_digital_global_projection( oa_api_client, test_database, mocker, add_digital_store, random_product_id, mock_territories ): """Test create endpoint.""" status_code, json = oa_api_client.upsert_digital_global_projection( random_product_id, { 'internal_note': 'test' } ) assert status_code == 201, \ 'Result of GET was {}, expected 201.'.format(json) assert json['internal_note'] == 'test' def test_upsert_digital_territory_projection( oa_api_client, test_database, mocker, add_digital_store, random_product_id, mock_territories, mock_set_marketing_priority, mock_get_project_for_product, mock_delete_project_marketing_priority_in_bulk, mock_get_project_marketing_priorities ): """Test create endpoint. Does not work in QA because the set marketing priority requires the product id to be in the releases table. """ if getenv('QA_DB_PASS'): return status_code, json = oa_api_client.upsert_digital_territory_projection( random_product_id, { 'items': [{ 'territory_id': 1, 'priority': 'a', }] } ) assert status_code == 201, \ 'Result of GET was {}, expected 201.'.format(json) result = json['items'][0] assert result['territory_id'] == 1 assert result['priority'] == 'a'