Esempio n. 1
0
def test_handle_complete_skip(workspace: Workspace,
                              mockpatch: MockPatcher) -> None:
    mockpatch(tft.artemis.tasks.update_guest_request,
              'ProvisioningTailHandler')

    assert workspace.handle_complete() is workspace
    assert workspace.result is None
    cast(
        MagicMock,
        tft.artemis.tasks.update_guest_request.
        ProvisioningTailHandler  # type: ignore[attr-defined]
    ).assert_not_called()
Esempio n. 2
0
def test_handle_complete(workspace: Workspace, mockpatch: MockPatcher) -> None:
    workspace.new_guest_data = MagicMock('new-guest-data')

    mockpatch(workspace, 'update_guest_state')

    assert workspace.handle_complete() is workspace

    cast(MagicMock, workspace.update_guest_state).assert_called_once_with(
        tft.artemis.guest.GuestState.PREPARING,
        current_state=tft.artemis.guest.GuestState.PROMISED,
        set_values=workspace.new_guest_data,
        current_pool_data=cast(
            MagicMock, workspace.current_pool_data.serialize).return_value)