def test_delete_offers(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'delete_offers', 'offers_update') with context: fake_manager.update_offers(offers_data) # Then we delete 2 offer_references = [x['offer_reference'] for x in offers_data[:2]] fake_manager.delete_offers(offer_references)
def test_update_messages(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'update_messages', 'messages_update') with context: message1 = Message(action='mark_as_read', id=u'6F9EF013-6387-F433-C3F5-4AAEF32AA317') message1.subject = 'order_information' fake_manager.update_messages([message1])
def test_query_offers_with_multiple_parameters(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'query_offers_with_multiple_parameters', 'offers_query') with context: date = Query('date', type='Created').between(min=dmin, max=dmax) quantity = Query('quantity').eq(10) fake_manager.query_offers(results_count=100, date=date, quantity=quantity)
def test_update_client_order_comments(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'update_client_order_comments', 'client_order_comments_update') with context: fake_manager.update_client_order_comments( seller_comment='Hello', order_fnac_id='8D7472DB-7EAF-CE05-A960-FC12B812FA14')
def test_query_pricing_with_invalid_ean(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'query_pricing_with_invalid_ean', 'pricing_query') with context: response = fake_manager.query_pricing(eans=['007']) errors = response.element.xpath('//ns:error', namespaces={'ns': XHTML_NAMESPACE}) assert len(errors) != 0
def test_update_orders(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'update_orders', 'orders_update') with context: action1 = {"order_detail_id": 1, "action": "Accepted"} action2 = {"order_detail_id": 2, "action": "Accepted"} fake_manager.update_orders(order_id="57BEAFDA828A8", order_update_action='accept_order', actions=[action1, action2])
def test_update_incidents(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'update_incidents', 'incidents_update') with context: reasons = [{"order_detail_id": 2, "refund_reason": 'no_stock'}] fake_manager.update_incidents(order_id='57BEAFDA828A8', incident_update_action='refund', reasons=reasons)
def test_query_pricing_with_no_ean(monkeypatch, fake_manager): """query_pricing should display an error message and return the error response when more there no EANs are passed""" context = create_context_for_requests(monkeypatch, fake_manager, 'query_pricing_with_no_ean', 'pricing_query') with context: response = fake_manager.query_pricing(eans=[]) errors = response.element.xpath('//ns:error', namespaces={'ns': XHTML_NAMESPACE}) assert len(errors) == 1
def test_query_pricing(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'query_pricing', 'pricing_query') with context: fake_manager.query_pricing([ { 'value': '9780262510875', 'type': 'Ean' }, { 'value': '2359109693', 'type': 'Isbn' }, { 'value': '8172119', 'type': 'FnacId' }, ])
def test_update_orders_with_tracking_number(monkeypatch, fake_manager): context = create_context_for_requests( monkeypatch, fake_manager, 'update_orders_with_tracking_number', 'orders_update') with context: action1 = { "order_detail_id": 1, "action": "Shipped", "tracking_number": "1234", "tracking_company": "Track Inc." } action2 = { "order_detail_id": 2, "action": "Shipped", "tracking_number": "5678", "tracking_company": "Track Inc." } fake_manager.update_orders(order_id="57BEAFDA828A8", order_update_action='update', actions=[action1, action2])
def test_query_pricing_with_invalid_code_type(monkeypatch, fake_manager): context = create_context_for_requests( monkeypatch, fake_manager, 'query_pricing_with_invalid_code_type', 'pricing_query') with context: response = fake_manager.query_pricing([ { 'value': '9780262510875', 'type': 'X' }, { 'value': '2359109693', 'type': 'Isbn' }, { 'value': '8172119', 'type': 'FnacId' }, ]) errors = response.element.xpath('//ns:error', namespaces={'ns': XHTML_NAMESPACE}) assert len(errors) != 0
def test_query_offers(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'query_offers', 'offers_query') with context: date = Query('date', type='Created').between(min=dmin, max=dmax) fake_manager.query_offers(results_count=100, date=date)
def test_query_pricing(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'query_pricing', 'pricing_query') with context: eans = [7321900286480, 9780262510875, 5060314991222] fake_manager.query_pricing(eans=eans)
def test_query_carriers(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'query_carriers', 'carriers_query') with context: fake_manager.query_carriers()
def test_update_offers(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'update_offers', 'offers_update') with context: fake_manager.update_offers(offers_data)
def test_query_client_order_comments(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'query_client_order_comments', 'client_order_comments_query') with context: fake_manager.query_client_order_comments(paging=1)
def test_query_orders(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'query_orders', 'orders_query') with context: fake_manager.query_orders(results_count=10, paging=1)
def test_get_batch_status(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'get_batch_status', 'batch_status') with context: fake_manager.get_batch_status('5D239E08-F6C1-8965-F2FA-7EFCC9E7BAD1')
def test_query_batch(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'query_batch', 'batch_query') with context: fake_manager.query_batch()
def test_query_messages(monkeypatch, fake_manager): context = create_context_for_requests(monkeypatch, fake_manager, 'query_messages', 'messages_query') with context: fake_manager.query_messages(paging=1, results_count=100)