def test_find_all_apis(api_gw_json_data): api_gw_instance = create_api_gw("json", data=api_gw_json_data) repository = ApiRepository(apis=api_gw_instance.apis) assert repository.find_all() is repository.apis
def test_find_api_by_id(api_gw_json_data): api_gw_instance = create_api_gw("json", data=api_gw_json_data) repository = ApiRepository(apis=api_gw_instance.apis) first_api = repository.apis[0] assert repository.find(first_api.id) is first_api
def test_find_all_upstreams(api_gw_json_data): api_gw_instance = create_api_gw("json", data=api_gw_json_data) repository = UpstreamRepository(upstreams=api_gw_instance.upstreams) assert repository.find_all() is repository.upstreams
def test_find_upstream_by_id(api_gw_json_data): api_gw_instance = create_api_gw("json", data=api_gw_json_data) repository = UpstreamRepository(upstreams=api_gw_instance.upstreams) first_upstream = repository.upstreams[0] assert repository.find(first_upstream.id) is first_upstream
def test_api_gw_with_route_specification(api_gw_json_data): api_gw_instance = create_api_gw("json", data=api_gw_json_data) assert api_gw_instance.route_specifications is not None assert type(api_gw_instance.route_specifications[0]) is RouteSpecification assert type(api_gw_instance.route_specifications[1]) is RouteSpecification
def test_api_gw_with_route_specification_wrong_data( api_gw_wrong_route_specification_json_data): with pytest.raises(ApiGWRouteSpecificationError): assert create_api_gw("json", data=api_gw_wrong_route_specification_json_data)
def test_api_gw_with_upstreams(api_gw_json_data): api_gw_instance = create_api_gw("json", data=api_gw_json_data) assert api_gw_instance.upstreams is not None assert type(api_gw_instance.upstreams[0]) is Upstream assert type(api_gw_instance.upstreams[1]) is Upstream
def test_api_gw_with_upstream_wrong_data(api_gw_wrong_upstream_json_data): with pytest.raises(ApiGWUpstreamError): assert create_api_gw("json", data=api_gw_wrong_upstream_json_data)
def test_api_gw_with_apis(api_gw_json_data): api_gw_instance = create_api_gw("json", data=api_gw_json_data) assert api_gw_instance.apis is not None assert type(api_gw_instance.apis[0]) is Api assert type(api_gw_instance.apis[1]) is Api
def test_api_gw_with_apis_wrong_data(api_gw_wrong_apis_json_data): with pytest.raises(ApiGWApiError): assert create_api_gw("json", data=api_gw_wrong_apis_json_data)
def test_api_gw_with_metadata_wrong_data(api_gw_wrong_json_data): with pytest.raises(ApiGWMetadataError): assert create_api_gw("json", data=api_gw_wrong_json_data)
def test_api_gw_with_metadata(api_gw_json_data): api_gw_instance = create_api_gw("json", data=api_gw_json_data) assert type(api_gw_instance.metadata) is Metadata
def test_api_gw_with_namespace(api_gw_json_data): api_gw_instance = create_api_gw("json", data=api_gw_json_data) assert api_gw_instance.namespace == "warehouse"
def test_api_gw_with_version_1(api_gw_json_data): api_gw_instance = create_api_gw("json", data=api_gw_json_data) assert api_gw_instance.version == "v1"
def test_create_api_gw_by_json(api_gw_json_data): api_gw_instance = create_api_gw("json", data=api_gw_json_data) assert type(api_gw_instance) is ApiGW