Beispiel #1
0
def test_azure_to_json():
    test_instance = azure_instance_mock()
    result = azure_to_json(test_instance)

    assert result['tags'] == test_instance.tags
    assert result['name'] == test_instance.name
    assert result['id'] == test_instance.id
    assert result['type'] == test_instance.type
    assert result['location'] == test_instance.location
    assert 'launch_time' not in result
Beispiel #2
0
def test_azure_to_local_instance():
    test_instance = azure_instance_mock()
    test_instance.tags = {'openqa_created_date': str(datetime.now())}
    test_vault_namespace = fake.uuid4()
    result = azure_to_local_instance(test_instance, test_vault_namespace)

    assert result.provider == ProviderChoice.AZURE
    assert result.vault_namespace == test_vault_namespace
    assert result.first_seen == dateutil.parser.parse(test_instance.tags.get('openqa_created_date'))
    assert result.instance_id == test_instance.name
    assert result.region == test_instance.location
    json.loads(result.csp_info)
Beispiel #3
0
def test_azure_to_json_launch_time():
    test_instance = azure_instance_mock()
    test_time = datetime.now()
    test_instance.tags = {'openqa_created_date': test_time}
    result = azure_to_json(test_instance)
    assert result['launch_time'] == test_time