Beispiel #1
0
def test_inventory_update_event_websocket_notifications(emit, inventory):
    source = InventorySource()
    source.save()
    iu = InventoryUpdate(id=123, inventory_source=source)
    iu.save()
    InventoryUpdateEvent.create_from_data(inventory_update_id=iu.pk)
    assert len(emit.call_args_list) == 1
    topic, payload = emit.call_args_list[0][0]
    assert topic == 'inventory_update_events-123'
    assert payload['inventory_update'] == 123
Beispiel #2
0
def test_cancel(mocker):
    with mock.patch.object(UnifiedJob, 'cancel', return_value=True) as parent_cancel:
        iu = InventoryUpdate()

        iu.save = mocker.MagicMock()
        build_job_explanation_mock = mocker.MagicMock()
        iu._build_job_explanation = mocker.MagicMock(return_value=build_job_explanation_mock)

        iu.cancel()

        parent_cancel.assert_called_with(is_chain=False, job_explanation=None)