コード例 #1
0
def test_legacy_unregister(handle_unregistration):
    '''
    handle_unregistration called when legacy upload
    '''
    config = InsightsConfig(legacy_upload=True)
    client = InsightsClient(config)
    client.unregister()
    handle_unregistration.assert_called_once()
コード例 #2
0
def test_platform_unregister_skip(handle_unregistration):
    '''
    handle_registration not called when platform upload
    '''
    config = InsightsConfig(legacy_upload=False)
    client = InsightsClient(config)
    assert client.unregister()  # short circuits to True
    handle_unregistration.assert_not_called()
コード例 #3
0
def test_unregister():
    config = InsightsConfig(unregister=True)
    client = InsightsClient(config)
    client.connection = FakeConnection(registered=True)
    client.session = True
    assert client.unregister() is True
    for r in constants.registered_files:
        assert os.path.isfile(r) is False
    for u in constants.unregistered_files:
        assert os.path.isfile(u) is True
コード例 #4
0
def test_reg_check_unregistered_unreachable():
    # unregister the machine first
    config = InsightsConfig(unregister=True)
    client = InsightsClient(config)
    client.connection = FakeConnection(registered=True)
    client.session = True
    assert client.unregister() is True

    # reset config and try to check registration
    config.unregister = False
    client.connection = FakeConnection(registered=False)
    assert client.get_registation_status()['unreachable'] is True
    assert client.register() is None
    for r in constants.registered_files:
        assert os.path.isfile(r) is False
    for u in constants.unregistered_files:
        assert os.path.isfile(u) is True