def test_from_dto():
    dto = {
        "systemName": "test_system",
        "address": "127.0.0.1",
        "port": 0,
        "authenticationInfo": "look away"
    }

    test_system = ArrowheadSystem.from_dto(dto)

    assert test_system.dto.keys() == valid_keys
    assert test_system.authority == '127.0.0.1:0'
    assert test_system.system_name == 'test_system'
    assert test_system.authentication_info == 'look away'
Exemple #2
0
    def query_result(self, query_response):
        query_data = query_response.read_json()['serviceQueryData'][0]
        service = Service(
            query_data['serviceDefinition']['serviceDefinition'],
            query_data['serviceUri'],
            query_data['interfaces'][0]['interfaceName'],
            query_data['secure'],
            query_data['metadata'],
            query_data['version'],
        )

        system = ArrowheadSystem.from_dto(query_data['provider'])

        return service, system
                            '5HaWr80uO0P+JNfbMD9e2FzMLRt9SBrTUKIMSXV/pQSGWQNQg5'
                            'QK0oAaeQT0RPgC8+XwKck0R33DCuh/I6gtPKlgGcOkabbbZucP'
                            'oRY6ZldB5Tm11mlWagjUGOzX3c8e2nhb02CDWcq8DWZW8cCBru'
                            'ODyicvk/Ocda3di4MtYkSdbsy6jbrQsTJnd5FXtAMAbeAnyY/S'
                            'b485AyByya7KQTmPAXVqnDZi314enjwJAJswIDAQAB',
)

consumer_data = setup_client.consume_service(
        'mgmt_register_system', json=consumer_system.dto()
).read_json()
provider_data = setup_client.consume_service(
        'mgmt_register_system', json=provider_system.dto()
).read_json()

systems = {
    'consumer': (ArrowheadSystem.from_dto(consumer_data), consumer_data['id']),
    'provider': (ArrowheadSystem.from_dto(provider_data), provider_data['id']),
}

hello_form = ServiceRegistrationForm.make(
        Service(
                'hello-arrowhead',
                'hello',
                ServiceInterface.from_str('HTTP-SECURE-JSON'),
                'TOKEN',
        ),
        systems['provider'][0],
)
echo_form = ServiceRegistrationForm.make(
        Service(
                'echo',