Пример #1
0
async def test_services_conformity(configure_schemas_location, push_services):
    from simcore_service_director import resources

    services = await push_services(1, 1)
    with resources.stream(resources.RESOURCE_NODE_SCHEMA) as file_pt:
        service_schema = json.load(file_pt)
    for service in services:
        # validate service
        json_schema_validator.validate_instance_object(
            service["service_description"], service_schema)
Пример #2
0
def test_v0_services_nonconformity(configure_schemas_location,
                                   push_v0_schema_services):
    from simcore_service_director import resources

    services = push_v0_schema_services(1, 1)
    with resources.stream(resources.RESOURCE_NODE_SCHEMA) as file_pt:
        service_schema = json.load(file_pt)

    for service in services:
        # validate service
        with pytest.raises(Exception,
                           message="expecting json schema validation error"):
            json_schema_validator.validate_instance_object(
                service["service_description"], service_schema)
Пример #3
0
def _check_services(created_services, services, schema_version="v1"):
    assert len(created_services) == len(services)

    created_service_descriptions = [x["service_description"] for x in created_services]

    json_schema_path = resources.get_path(resources.RESOURCE_NODE_SCHEMA)
    assert json_schema_path.exists() == True
    with json_schema_path.open() as file_pt:
        service_schema = json.load(file_pt)

    for service in services:
        if schema_version == "v1":
            assert created_service_descriptions.count(service) == 1
        json_schema_validator.validate_instance_object(service, service_schema)