示例#1
0
def test_list_db_systems_service_error(db_client):
    error_message = 'Internal Server Error'
    module = get_module(dict({'db_home_id': 'ocid1.dbhome.aaaa'}))
    db_client.get_db_system.side_effect = ServiceError(
        499, 'InternalServerError', dict(), error_message)
    try:
        oci_db_home_facts.list_db_homes(db_client, module)
    except Exception as ex:
        assert error_message in ex.args[0]
def test_list_db_homes_list_all(db_client, list_all_resources_patch):
    module = get_module(
        dict({
            'compartment_id': 'ocid1.compartment.aaaa',
            'db_system_id': 'ocid1.dbsystem.aaaa',
            'display_name': None
        }))
    list_all_resources_patch.return_value = get_db_homes()
    result = oci_db_home_facts.list_db_homes(db_client, module)
    assert len(result['db_homes']) is 2
def test_list_db_homes_list_all(db_client, list_all_resources_patch):
    module = get_module(
        dict({
            "compartment_id": "ocid1.compartment.aaaa",
            "db_system_id": "ocid1.dbsystem.aaaa",
            "display_name": None,
        }))
    list_all_resources_patch.return_value = get_db_homes()
    result = oci_db_home_facts.list_db_homes(db_client, module)
    assert len(result["db_homes"]) is 2
示例#4
0
def test_list_db_homes_list_specific(db_client):
    module = get_module(dict({'db_home_id': 'ocid1.dbhome.aaaa'}))
    db_client.get_db_home.return_value = get_response(
        200, None, get_db_home(), None)
    result = oci_db_home_facts.list_db_homes(db_client, module)
    assert result['db_homes'][0]['display_name'] is 'ansibledbhome'
def test_list_db_homes_list_specific(db_client):
    module = get_module(dict({"db_home_id": "ocid1.dbhome.aaaa"}))
    db_client.get_db_home.return_value = get_response(200, None, get_db_home(),
                                                      None)
    result = oci_db_home_facts.list_db_homes(db_client, module)
    assert result["db_homes"][0]["display_name"] is "ansibledbhome"