Open Jvlythical opened 1 month ago
Test failures with Python 3.12
Installing the current project: stoobly-agent (0.34.9)
| poetry run pytest stoobly_agent/test/
| ============================= test session starts ==============================
| platform linux -- Python 3.12.3, pytest-7.4.2, pluggy-1.3.0
| rootdir: /home/user/folder/stoobly-agent
| configfile: pytest.ini
collected 287 items
|
| stoobly_agent/test/app/cli/cli_mock_integration_test.py .... [ 1%]
| stoobly_agent/test/app/cli/config/firewall_test.py . [ 1%]
| stoobly_agent/test/app/cli/config/match_test.py . [ 2%]
| stoobly_agent/test/app/cli/config/rewrite_test.py ................... [ 8%]
| stoobly_agent/test/app/cli/config/project/config_project_set_test.py . [ 9%]
| stoobly_agent/test/app/cli/config/scenario/config_scenario_set_test.py . [ 9%]
| . [ 9%]
| stoobly_agent/test/app/cli/endpoint/endpoint_cli_apply_test.py EE [ 10%]
| stoobly_agent/test/app/cli/helpers/openapi_endpoint_adapter_additional_props_test.py F [ 10%]
| [ 10%]
| stoobly_agent/test/app/cli/helpers/openapi_endpoint_adapter_missing_info_test.py F [ 11%]
| [ 11%]
| stoobly_agent/test/app/cli/helpers/openapi_endpoint_adapter_missing_oauth2_scopes_test.py F [ 11%]
| [ 11%]
| stoobly_agent/test/app/cli/helpers/openapi_endpoint_adapter_missing_servers_test.py F [ 11%]
| [ 11%]
| stoobly_agent/test/app/cli/helpers/openapi_endpoint_adapter_test.py FFFF [ 13%]
| [ 13%]
| stoobly_agent/test/app/cli/helpers/schema_builder_test.py .... [ 14%]
| stoobly_agent/test/app/cli/helpers/synchronize_request_service_test.py . [ 14%]
| ........ [ 17%]
| stoobly_agent/test/app/cli/intercept/intercept_configure_test.py . [ 18%]
| stoobly_agent/test/app/cli/intercept/intercept_enable_test.py .. [ 18%]
| stoobly_agent/test/app/cli/request/request_delete_test.py .. [ 19%]
| stoobly_agent/test/app/cli/request/request_list_test.py ..... [ 21%]
| stoobly_agent/test/app/cli/request/request_replay_test.py ......... [ 24%]
| stoobly_agent/test/app/cli/request/request_reset_test.py . [ 24%]
| stoobly_agent/test/app/cli/request/request_response_test.py . [ 25%]
| stoobly_agent/test/app/cli/request/request_snapshot_test.py ..... [ 26%]
| stoobly_agent/test/app/cli/request/request_test_test.py ........... [ 30%]
| stoobly_agent/test/app/cli/scenario/scenario_create_test.py .... [ 32%]
| stoobly_agent/test/app/cli/scenario/scenario_replay_integration_test.py . [ 32%]
| ......... [ 35%]
| stoobly_agent/test/app/cli/scenario/scenario_replay_test.py ....... [ 37%]
| stoobly_agent/test/app/cli/scenario/scenario_reset_test.py . [ 38%]
| stoobly_agent/test/app/cli/scenario/scenario_snapshot_test.py .... [ 39%]
| stoobly_agent/test/app/cli/scenario/scenario_test_integration_test.py .. [ 40%]
| .. [ 41%]
| stoobly_agent/test/app/cli/snapshot/snapshot_apply_test.py ............ [ 45%]
| stoobly_agent/test/app/cli/snapshot/snapshot_prune_test.py ... [ 46%]
| stoobly_agent/test/app/cli/snapshot/snapshot_update_test.py ...... [ 48%]
| stoobly_agent/test/app/models/adapters/orm/joined_request_string_adapter_test.py . [ 48%]
| ... [ 49%]
| stoobly_agent/test/app/models/adapters/orm/request/orm_mitmproxy_request_adapter_test.py . [ 50%]
| ..... [ 51%]
| stoobly_agent/test/app/models/adapters/orm/request/orm_python_request_adapter_test.py . [ 52%]
| .... [ 53%]
| stoobly_agent/test/app/models/adapters/orm/response/orm_mitmproxy_response_adapter_test.py . [ 54%]
| ... [ 55%]
| stoobly_agent/test/app/models/adapters/orm/response/orm_python_response_adapter_test.py . [ 55%]
| .. [ 56%]
| stoobly_agent/test/app/models/adapters/python/request/mitmproxy_adapter_test.py . [ 56%]
| . [ 56%]
| stoobly_agent/test/app/models/adapters/python/request/raw_adapter_test.py . [ 57%]
| . [ 57%]
| stoobly_agent/test/app/models/adapters/python/request/stoobly_adapter_test.py . [ 57%]
| . [ 58%]
| stoobly_agent/test/app/models/adapters/python/response/mitmproxy_response_adapter_test.py . [ 58%]
| . [ 58%]
| stoobly_agent/test/app/models/adapters/python/response/raw_response_adapter_test.py . [ 59%]
| . [ 59%]
| stoobly_agent/test/app/models/factories/resource/local_db/request_adapter_test.py . [ 59%]
| .. [ 60%]
| stoobly_agent/test/app/models/factories/resource/local_db/response_adapter_test.py . [ 60%]
| [ 60%]
| stoobly_agent/test/app/models/factories/resource/local_db/helpers/log_test.py . [ 61%]
| ... [ 62%]
| stoobly_agent/test/app/models/factories/resource/local_db/helpers/tiebreak_scenario_request_test.py . [ 62%]
| ...... [ 64%]
| stoobly_agent/test/app/models/schemas/request_test.py ...... [ 66%]
| stoobly_agent/test/app/proxy/mitmproxy/request_facade_test.py ........ [ 69%]
| stoobly_agent/test/app/proxy/mock/eval_fixtures_service_test.py .. [ 70%]
| stoobly_agent/test/app/proxy/replay/body_parser_service_test.py .. [ 71%]
| stoobly_agent/test/app/proxy/replay/rewrite_params_service_test.py ... [ 72%]
| stoobly_agent/test/app/proxy/replay/trace_context_test.py ..... [ 73%]
| stoobly_agent/test/app/proxy/replay/visitor_test.py ................ [ 79%]
| stoobly_agent/test/app/proxy/test/helpers/test_results_builder_test.py . [ 79%]
| ........... [ 83%]
| stoobly_agent/test/app/proxy/upload/request_string_test.py .. [ 84%]
| stoobly_agent/test/app/proxy/upload/response_string_test.py . [ 84%]
| stoobly_agent/test/app/test/matchers/contract_test.py ....... [ 87%]
| stoobly_agent/test/app/test/matchers/diff_test.py ........... [ 90%]
| stoobly_agent/test/app/test/matchers/fuzzy_test.py ..... [ 92%]
| stoobly_agent/test/cli/mock_test.py ... [ 93%]
| stoobly_agent/test/cli/record_test.py ............... [ 98%]
| stoobly_agent/test/config/data_dir_test.py ... [100%]
|
| ==================================== ERRORS ====================================
| _ ERROR at setup of TestApply.TestWhenApplyingPestoreExpanded.test_it_deletes __
|
| self = <endpoint_cli_apply_test.TestApply.TestWhenApplyingPestoreExpanded object at 0x7fd722d102f0>
| runner = <click.testing.CliRunner object at 0x7fd7216d9f70>
| petstore_expanded_file_path = '/home/user/folder/stoobly-agent/stoobly_agent/test/mock_data/petstore-expanded.yaml'
|
| @pytest.fixture(scope='class', autouse=True)
| def import_result(self, runner: CliRunner, petstore_expanded_file_path: str):
| record_result = runner.invoke(endpoint, ['apply', '--source-format', OPENAPI_FORMAT, '--source-path', petstore_expanded_file_path])
| > assert record_result.exit_code == 0
| E assert 1 == 0
| E + where 1 = <Result AttributeError("'_io.BufferedReader' object has no attribute 'decode'")>.exit_code
|
| stoobly_agent/test/app/cli/endpoint/endpoint_cli_apply_test.py:102: AssertionError
| ___ ERROR at setup of TestApply.TestWhenApplyingPestoreExpanded.test_it_adds ___
|
| self = <endpoint_cli_apply_test.TestApply.TestWhenApplyingPestoreExpanded object at 0x7fd722d102f0>
| runner = <click.testing.CliRunner object at 0x7fd7216d9f70>
| petstore_expanded_file_path = '/home/user/folder/stoobly-agent/stoobly_agent/test/mock_data/petstore-expanded.yaml'
|
| @pytest.fixture(scope='class', autouse=True)
| def import_result(self, runner: CliRunner, petstore_expanded_file_path: str):
| record_result = runner.invoke(endpoint, ['apply', '--source-format', OPENAPI_FORMAT, '--source-path', petstore_expanded_file_path])
| > assert record_result.exit_code == 0
| E assert 1 == 0
| E + where 1 = <Result AttributeError("'_io.BufferedReader' object has no attribute 'decode'")>.exit_code
|
| stoobly_agent/test/app/cli/endpoint/endpoint_cli_apply_test.py:102: AssertionError
| =================================== FAILURES ===================================
| ________ TestOpenApiEndpointAdapterAdditionalProps.test_adapt_from_file ________
|
| self = <openapi_endpoint_adapter_additional_props_test.TestOpenApiEndpointAdapterAdditionalProps object at 0x7fd721e70d10>
| open_api_endpoint_adapter = <stoobly_agent.app.cli.helpers.openapi_endpoint_adapter.OpenApiEndpointAdapter object at 0x7fd7216dba70>
| petstore_file_path = PosixPath('/home/user/folder/stoobly-agent/stoobly_agent/test/mock_data/petstore-additional-props.yaml')
| expected_post_pets_endpoint = {'body_param_names': [{'body_param_name_id': None, 'endpoint_id': 1, 'id': 1, 'inferred_type': 'String', ...}], 'host': 'petstore.swagger.io', 'id': 1, 'match_pattern': '/v1/pets', ...}
|
| def test_adapt_from_file(self, open_api_endpoint_adapter, petstore_file_path, expected_post_pets_endpoint):
| adapter = open_api_endpoint_adapter
|
| > endpoints = adapter.adapt_from_file(petstore_file_path)
|
| stoobly_agent/test/app/cli/helpers/openapi_endpoint_adapter_additional_props_test.py:64:
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
| stoobly_agent/app/cli/helpers/openapi_endpoint_adapter.py:38: in adapt_from_file
| spec = Spec.from_dict(file_data)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_core/spec/paths.py:56: in from_dict
| validator.validate(data, spec_url=spec_url)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/proxies.py:27: in validate
| for err in validator.iter_errors(instance, spec_url=spec_url):
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/decorators.py:22: in wrapper
| for err in errors:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/validators.py:89: in iter_errors
| yield from self.schema_validator.iter_errors(instance)
| <attrs generated init jsonschema.validators.create.<locals>.Validator>:5: in __init__
| self.__attrs_post_init__()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:216: in __attrs_post_init__
| self.resolver = RefResolver.from_schema(
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:772: in from_schema
| return cls(base_uri=id_of(schema), referrer=schema, *args, **kwargs) # noqa: B026, E501
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/_legacy_validators.py:12: in id_of
| if schema is True or schema is False or "$ref" in schema:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:28: in get_schema_content
| content, _ = get_schema(version)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:24: in get_schema
| return FilePathReader(schema_path_full).read()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/readers.py:37: in read
| return all_urls_handler(uri), uri
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:45: in __call__
| return self._open(uri)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/urllib.py:18: in _open
| return super().__call__(fh)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:41: in __call__
| parsed_url = urlparse(uri)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:394: in urlparse
| url, scheme, _coerce_result = _coerce_args(url, scheme)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:133: in _coerce_args
| return _decode_args(args) + (_encode_result,)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in _decode_args
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in <genexpr>
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
| self = <addinfourl at 140561956692736 whose fp = <_io.BufferedReader name='/root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/resources/schemas/v3.0/schema.json'>>
| name = 'decode'
|
| def __getattr__(self, name):
| # Attribute lookups are delegated to the underlying file
| # and cached for non-numeric results
| # (i.e. methods are cached, closed and friends are not)
| file = self.__dict__['file']
| > a = getattr(file, name)
| E AttributeError: '_io.BufferedReader' object has no attribute 'decode'
|
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/tempfile.py:494: AttributeError
| __________ TestOpenApiEndpointAdapterMissingInfo.test_adapt_from_file __________
|
| self = <openapi_endpoint_adapter_missing_info_test.TestOpenApiEndpointAdapterMissingInfo object at 0x7fd721e731a0>
| open_api_endpoint_adapter = <stoobly_agent.app.cli.helpers.openapi_endpoint_adapter.OpenApiEndpointAdapter object at 0x7fd7216d9610>
| petstore_file_path = PosixPath('/home/user/folder/stoobly-agent/stoobly_agent/test/mock_data/petstore-missing-info.yaml')
| expected_get_pets_endpoint = {'host': '-', 'id': 1, 'match_pattern': '/pets', 'method': 'GET', ...}
|
| def test_adapt_from_file(self, open_api_endpoint_adapter, petstore_file_path, expected_get_pets_endpoint):
| adapter = open_api_endpoint_adapter
|
| > endpoints = adapter.adapt_from_file(petstore_file_path)
|
| stoobly_agent/test/app/cli/helpers/openapi_endpoint_adapter_missing_info_test.py:114:
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
| stoobly_agent/app/cli/helpers/openapi_endpoint_adapter.py:38: in adapt_from_file
| spec = Spec.from_dict(file_data)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_core/spec/paths.py:56: in from_dict
| validator.validate(data, spec_url=spec_url)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/proxies.py:27: in validate
| for err in validator.iter_errors(instance, spec_url=spec_url):
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/decorators.py:22: in wrapper
| for err in errors:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/validators.py:89: in iter_errors
| yield from self.schema_validator.iter_errors(instance)
| <attrs generated init jsonschema.validators.create.<locals>.Validator>:5: in __init__
| self.__attrs_post_init__()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:216: in __attrs_post_init__
| self.resolver = RefResolver.from_schema(
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:772: in from_schema
| return cls(base_uri=id_of(schema), referrer=schema, *args, **kwargs) # noqa: B026, E501
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/_legacy_validators.py:12: in id_of
| if schema is True or schema is False or "$ref" in schema:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:28: in get_schema_content
| content, _ = get_schema(version)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:24: in get_schema
| return FilePathReader(schema_path_full).read()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/readers.py:37: in read
| return all_urls_handler(uri), uri
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:45: in __call__
| return self._open(uri)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/urllib.py:18: in _open
| return super().__call__(fh)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:41: in __call__
| parsed_url = urlparse(uri)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:394: in urlparse
| url, scheme, _coerce_result = _coerce_args(url, scheme)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:133: in _coerce_args
| return _decode_args(args) + (_encode_result,)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in _decode_args
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in <genexpr>
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
| self = <addinfourl at 140561956326336 whose fp = <_io.BufferedReader name='/root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/resources/schemas/v3.0/schema.json'>>
| name = 'decode'
|
| def __getattr__(self, name):
| # Attribute lookups are delegated to the underlying file
| # and cached for non-numeric results
| # (i.e. methods are cached, closed and friends are not)
| file = self.__dict__['file']
| > a = getattr(file, name)
| E AttributeError: '_io.BufferedReader' object has no attribute 'decode'
|
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/tempfile.py:494: AttributeError
| ______ TestOpenApiEndpointAdapterMissingOauthScopes.test_adapt_from_file _______
|
| self = <openapi_endpoint_adapter_missing_oauth2_scopes_test.TestOpenApiEndpointAdapterMissingOauthScopes object at 0x7fd721e73da0>
| open_api_endpoint_adapter = <stoobly_agent.app.cli.helpers.openapi_endpoint_adapter.OpenApiEndpointAdapter object at 0x7fd7216dad20>
| petstore_file_path = PosixPath('/home/user/folder/stoobly-agent/stoobly_agent/test/mock_data/petstore-missing-oauth2-scopes.yaml')
| expected_get_pets_endpoint = {'host': 'petstore.swagger.io', 'id': 1, 'match_pattern': '/v1/pets', 'method': 'GET', ...}
|
| def test_adapt_from_file(self, open_api_endpoint_adapter, petstore_file_path, expected_get_pets_endpoint):
| adapter = open_api_endpoint_adapter
|
| > endpoints = adapter.adapt_from_file(petstore_file_path)
|
| stoobly_agent/test/app/cli/helpers/openapi_endpoint_adapter_missing_oauth2_scopes_test.py:118:
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
| stoobly_agent/app/cli/helpers/openapi_endpoint_adapter.py:38: in adapt_from_file
| spec = Spec.from_dict(file_data)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_core/spec/paths.py:56: in from_dict
| validator.validate(data, spec_url=spec_url)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/proxies.py:27: in validate
| for err in validator.iter_errors(instance, spec_url=spec_url):
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/decorators.py:22: in wrapper
| for err in errors:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/validators.py:89: in iter_errors
| yield from self.schema_validator.iter_errors(instance)
| <attrs generated init jsonschema.validators.create.<locals>.Validator>:5: in __init__
| self.__attrs_post_init__()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:216: in __attrs_post_init__
| self.resolver = RefResolver.from_schema(
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:772: in from_schema
| return cls(base_uri=id_of(schema), referrer=schema, *args, **kwargs) # noqa: B026, E501
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/_legacy_validators.py:12: in id_of
| if schema is True or schema is False or "$ref" in schema:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:28: in get_schema_content
| content, _ = get_schema(version)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:24: in get_schema
| return FilePathReader(schema_path_full).read()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/readers.py:37: in read
| return all_urls_handler(uri), uri
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:45: in __call__
| return self._open(uri)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/urllib.py:18: in _open
| return super().__call__(fh)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:41: in __call__
| parsed_url = urlparse(uri)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:394: in urlparse
| url, scheme, _coerce_result = _coerce_args(url, scheme)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:133: in _coerce_args
| return _decode_args(args) + (_encode_result,)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in _decode_args
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in <genexpr>
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
| self = <addinfourl at 140561955812368 whose fp = <_io.BufferedReader name='/root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/resources/schemas/v3.0/schema.json'>>
| name = 'decode'
|
| def __getattr__(self, name):
| # Attribute lookups are delegated to the underlying file
| # and cached for non-numeric results
| # (i.e. methods are cached, closed and friends are not)
| file = self.__dict__['file']
| > a = getattr(file, name)
| E AttributeError: '_io.BufferedReader' object has no attribute 'decode'
|
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/tempfile.py:494: AttributeError
| ________ TestOpenApiEndpointAdapterMissingServers.test_adapt_from_file _________
|
| self = <openapi_endpoint_adapter_missing_servers_test.TestOpenApiEndpointAdapterMissingServers object at 0x7fd721e72600>
| open_api_endpoint_adapter = <stoobly_agent.app.cli.helpers.openapi_endpoint_adapter.OpenApiEndpointAdapter object at 0x7fd7217c4260>
| petstore_file_path = PosixPath('/home/user/folder/stoobly-agent/stoobly_agent/test/mock_data/petstore-missing-servers.yaml')
| expected_get_pets_endpoint = {'host': '-', 'id': 1, 'match_pattern': '/pets', 'method': 'GET', ...}
|
| def test_adapt_from_file(self, open_api_endpoint_adapter, petstore_file_path, expected_get_pets_endpoint):
| adapter = open_api_endpoint_adapter
|
| > endpoints = adapter.adapt_from_file(petstore_file_path)
|
| stoobly_agent/test/app/cli/helpers/openapi_endpoint_adapter_missing_servers_test.py:114:
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
| stoobly_agent/app/cli/helpers/openapi_endpoint_adapter.py:38: in adapt_from_file
| spec = Spec.from_dict(file_data)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_core/spec/paths.py:56: in from_dict
| validator.validate(data, spec_url=spec_url)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/proxies.py:27: in validate
| for err in validator.iter_errors(instance, spec_url=spec_url):
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/decorators.py:22: in wrapper
| for err in errors:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/validators.py:89: in iter_errors
| yield from self.schema_validator.iter_errors(instance)
| <attrs generated init jsonschema.validators.create.<locals>.Validator>:5: in __init__
| self.__attrs_post_init__()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:216: in __attrs_post_init__
| self.resolver = RefResolver.from_schema(
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:772: in from_schema
| return cls(base_uri=id_of(schema), referrer=schema, *args, **kwargs) # noqa: B026, E501
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/_legacy_validators.py:12: in id_of
| if schema is True or schema is False or "$ref" in schema:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:28: in get_schema_content
| content, _ = get_schema(version)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:24: in get_schema
| return FilePathReader(schema_path_full).read()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/readers.py:37: in read
| return all_urls_handler(uri), uri
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:45: in __call__
| return self._open(uri)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/urllib.py:18: in _open
| return super().__call__(fh)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:41: in __call__
| parsed_url = urlparse(uri)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:394: in urlparse
| url, scheme, _coerce_result = _coerce_args(url, scheme)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:133: in _coerce_args
| return _decode_args(args) + (_encode_result,)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in _decode_args
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in <genexpr>
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
| self = <addinfourl at 140561956697488 whose fp = <_io.BufferedReader name='/root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/resources/schemas/v3.0/schema.json'>>
| name = 'decode'
|
| def __getattr__(self, name):
| # Attribute lookups are delegated to the underlying file
| # and cached for non-numeric results
| # (i.e. methods are cached, closed and friends are not)
| file = self.__dict__['file']
| > a = getattr(file, name)
| E AttributeError: '_io.BufferedReader' object has no attribute 'decode'
|
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/tempfile.py:494: AttributeError
| _ TestOpenApiEndpointAdapter.TestWhenAdaptingPestoreExpanded.test_adapt_from_file _
|
| self = <openapi_endpoint_adapter_test.TestOpenApiEndpointAdapter.TestWhenAdaptingPestoreExpanded object at 0x7fd721e75df0>
| open_api_endpoint_adapter = <stoobly_agent.app.cli.helpers.openapi_endpoint_adapter.OpenApiEndpointAdapter object at 0x7fd7217c4da0>
| petstore_expanded_file_path = PosixPath('/home/user/folder/stoobly-agent/stoobly_agent/test/mock_data/petstore-expanded.yaml')
| expected_v2_get_pets_endpoint = {'host': 'petstore.swagger.io', 'id': 1, 'match_pattern': '/v2/pets', 'method': 'GET', ...}
| expected_v2_post_pets_endpoint = {'body_param_names': [{'body_param_name_id': None, 'endpoint_id': 2, 'id': 1, 'inferred_type': 'String', ...}, {'body_...2, 'id': 2, 'inferred_type': 'String', ...}], 'host': 'petstore.swagger.io', 'id': 2, 'match_pattern': '/v2/pets', ...}
| expected_v2_get_pets_id_endpoint = {'aliases': [{'id': 1, 'name': '{id}'}], 'host': 'petstore.swagger.io', 'id': 3, 'match_pattern': '/v2/pets/%', ...}
| expected_v2_delete_pets_id_endpoint = {'aliases': [{'id': 1, 'name': '{id}'}], 'host': 'petstore.swagger.io', 'id': 4, 'match_pattern': '/v2/pets/%', ...}
|
| def test_adapt_from_file(self, open_api_endpoint_adapter, petstore_expanded_file_path, expected_v2_get_pets_endpoint, expected_v2_post_pets_endpoint, expected_v2_get_pets_id_endpoint, expected_v2_delete_pets_id_endpoint):
| adapter = open_api_endpoint_adapter
| file_path = petstore_expanded_file_path
|
| > endpoints = adapter.adapt_from_file(file_path)
|
| stoobly_agent/test/app/cli/helpers/openapi_endpoint_adapter_test.py:317:
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
| stoobly_agent/app/cli/helpers/openapi_endpoint_adapter.py:38: in adapt_from_file
| spec = Spec.from_dict(file_data)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_core/spec/paths.py:56: in from_dict
| validator.validate(data, spec_url=spec_url)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/proxies.py:27: in validate
| for err in validator.iter_errors(instance, spec_url=spec_url):
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/decorators.py:22: in wrapper
| for err in errors:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/validators.py:89: in iter_errors
| yield from self.schema_validator.iter_errors(instance)
| <attrs generated init jsonschema.validators.create.<locals>.Validator>:5: in __init__
| self.__attrs_post_init__()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:216: in __attrs_post_init__
| self.resolver = RefResolver.from_schema(
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:772: in from_schema
| return cls(base_uri=id_of(schema), referrer=schema, *args, **kwargs) # noqa: B026, E501
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/_legacy_validators.py:12: in id_of
| if schema is True or schema is False or "$ref" in schema:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:28: in get_schema_content
| content, _ = get_schema(version)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:24: in get_schema
| return FilePathReader(schema_path_full).read()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/readers.py:37: in read
| return all_urls_handler(uri), uri
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:45: in __call__
| return self._open(uri)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/urllib.py:18: in _open
| return super().__call__(fh)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:41: in __call__
| parsed_url = urlparse(uri)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:394: in urlparse
| url, scheme, _coerce_result = _coerce_args(url, scheme)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:133: in _coerce_args
| return _decode_args(args) + (_encode_result,)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in _decode_args
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in <genexpr>
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
| self = <addinfourl at 140561955930816 whose fp = <_io.BufferedReader name='/root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/resources/schemas/v3.0/schema.json'>>
| name = 'decode'
|
| def __getattr__(self, name):
| # Attribute lookups are delegated to the underlying file
| # and cached for non-numeric results
| # (i.e. methods are cached, closed and friends are not)
| file = self.__dict__['file']
| > a = getattr(file, name)
| E AttributeError: '_io.BufferedReader' object has no attribute 'decode'
|
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/tempfile.py:494: AttributeError
| ____ TestOpenApiEndpointAdapter.TestWhenAdaptingUspto.test_adapt_from_file _____
|
| self = <openapi_endpoint_adapter_test.TestOpenApiEndpointAdapter.TestWhenAdaptingUspto object at 0x7fd721e76bd0>
| open_api_endpoint_adapter = <stoobly_agent.app.cli.helpers.openapi_endpoint_adapter.OpenApiEndpointAdapter object at 0x7fd72173d070>
| uspto_file_path = PosixPath('/home/user/folder/stoobly-agent/stoobly_agent/test/mock_data/uspto.yaml')
| expected_get_root_https = {'host': 'developer.uspto.gov', 'id': 1, 'match_pattern': '/ds-api/', 'method': 'GET', ...}
| expected_get_root_http = {'host': 'developer.uspto.gov', 'id': 4, 'match_pattern': '/ds-api/', 'method': 'GET', ...}
| expected_get_dataset_version_fields_https = {'aliases': [{'id': 1, 'name': '{dataset}'}, {'id': 2, 'name': '{version}'}], 'host': 'developer.uspto.gov', 'id': 2, 'match_pattern': '/ds-api/%/%/fields', ...}
| expected_get_dataset_version_fields_http = {'aliases': [{'id': 1, 'name': '{dataset}'}, {'id': 2, 'name': '{version}'}], 'host': 'developer.uspto.gov', 'id': 5, 'match_pattern': '/ds-api/%/%/fields', ...}
| expected_post_dataset_version_records_https = {'aliases': [{'id': 1, 'name': '{version}'}, {'id': 2, 'name': '{dataset}'}], 'body_param_names': [{'body_param_name_i...e_id': None, 'endpoint_id': 3, 'id': 3, 'inferred_type': 'Integer', ...}], 'host': 'developer.uspto.gov', 'id': 3, ...}
| expected_post_dataset_version_records_http = {'aliases': [{'id': 1, 'name': '{version}'}, {'id': 2, 'name': '{dataset}'}], 'body_param_names': [{'body_param_name_i...e_id': None, 'endpoint_id': 6, 'id': 3, 'inferred_type': 'Integer', ...}], 'host': 'developer.uspto.gov', 'id': 6, ...}
|
| def test_adapt_from_file(self, open_api_endpoint_adapter, uspto_file_path, expected_get_root_https, expected_get_root_http, expected_get_dataset_version_fields_https, expected_get_dataset_version_fields_http, expected_post_dataset_version_records_https, expected_post_dataset_version_records_http):
| adapter = open_api_endpoint_adapter
| file_path = uspto_file_path
|
| > endpoints = adapter.adapt_from_file(file_path)
|
| stoobly_agent/test/app/cli/helpers/openapi_endpoint_adapter_test.py:559:
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
| stoobly_agent/app/cli/helpers/openapi_endpoint_adapter.py:38: in adapt_from_file
| spec = Spec.from_dict(file_data)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_core/spec/paths.py:56: in from_dict
| validator.validate(data, spec_url=spec_url)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/proxies.py:27: in validate
| for err in validator.iter_errors(instance, spec_url=spec_url):
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/decorators.py:22: in wrapper
| for err in errors:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/validators.py:89: in iter_errors
| yield from self.schema_validator.iter_errors(instance)
| <attrs generated init jsonschema.validators.create.<locals>.Validator>:5: in __init__
| self.__attrs_post_init__()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:216: in __attrs_post_init__
| self.resolver = RefResolver.from_schema(
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:772: in from_schema
| return cls(base_uri=id_of(schema), referrer=schema, *args, **kwargs) # noqa: B026, E501
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/_legacy_validators.py:12: in id_of
| if schema is True or schema is False or "$ref" in schema:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:28: in get_schema_content
| content, _ = get_schema(version)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:24: in get_schema
| return FilePathReader(schema_path_full).read()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/readers.py:37: in read
| return all_urls_handler(uri), uri
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:45: in __call__
| return self._open(uri)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/urllib.py:18: in _open
| return super().__call__(fh)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:41: in __call__
| parsed_url = urlparse(uri)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:394: in urlparse
| url, scheme, _coerce_result = _coerce_args(url, scheme)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:133: in _coerce_args
| return _decode_args(args) + (_encode_result,)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in _decode_args
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in <genexpr>
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
| self = <addinfourl at 140561955920528 whose fp = <_io.BufferedReader name='/root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/resources/schemas/v3.0/schema.json'>>
| name = 'decode'
|
| def __getattr__(self, name):
| # Attribute lookups are delegated to the underlying file
| # and cached for non-numeric results
| # (i.e. methods are cached, closed and friends are not)
| file = self.__dict__['file']
| > a = getattr(file, name)
| E AttributeError: '_io.BufferedReader' object has no attribute 'decode'
|
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/tempfile.py:494: AttributeError
| _ TestOpenApiEndpointAdapter.TestWhenAdaptingPetstoreReferences.test_adapt_from_file _
|
| self = <openapi_endpoint_adapter_test.TestOpenApiEndpointAdapter.TestWhenAdaptingPetstoreReferences object at 0x7fd721e77710>
| open_api_endpoint_adapter = <stoobly_agent.app.cli.helpers.openapi_endpoint_adapter.OpenApiEndpointAdapter object at 0x7fd72173aae0>
| petstore_references_file_path = PosixPath('/home/user/folder/stoobly-agent/stoobly_agent/test/mock_data/petstore-references.yaml')
| expected_get_v1_pets_ref = {'body_param_names': [{'body_param_name_id': None, 'endpoint_id': 1, 'id': 1, 'inferred_type': 'String', ...}, {'body_...': 6, 'inferred_type': 'Boolean', ...}, ...], 'host': 'petstore.swagger.io', 'id': 1, 'match_pattern': '/v1/pets', ...}
| expected_get_v2_pets_ref = {'body_param_names': [{'body_param_name_id': None, 'endpoint_id': 2, 'id': 1, 'inferred_type': 'Hash', ...}, {'body_pa...': 6, 'inferred_type': 'Integer', ...}, ...], 'host': 'petstore.swagger.io', 'id': 2, 'match_pattern': '/v2/pets', ...}
|
| def test_adapt_from_file(self, open_api_endpoint_adapter, petstore_references_file_path, expected_get_v1_pets_ref, expected_get_v2_pets_ref):
| adapter = open_api_endpoint_adapter
| file_path = petstore_references_file_path
|
| > endpoints = adapter.adapt_from_file(file_path)
|
| stoobly_agent/test/app/cli/helpers/openapi_endpoint_adapter_test.py:819:
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
| stoobly_agent/app/cli/helpers/openapi_endpoint_adapter.py:38: in adapt_from_file
| spec = Spec.from_dict(file_data)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_core/spec/paths.py:56: in from_dict
| validator.validate(data, spec_url=spec_url)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/proxies.py:27: in validate
| for err in validator.iter_errors(instance, spec_url=spec_url):
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/decorators.py:22: in wrapper
| for err in errors:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/validators.py:89: in iter_errors
| yield from self.schema_validator.iter_errors(instance)
| <attrs generated init jsonschema.validators.create.<locals>.Validator>:5: in __init__
| self.__attrs_post_init__()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:216: in __attrs_post_init__
| self.resolver = RefResolver.from_schema(
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:772: in from_schema
| return cls(base_uri=id_of(schema), referrer=schema, *args, **kwargs) # noqa: B026, E501
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/_legacy_validators.py:12: in id_of
| if schema is True or schema is False or "$ref" in schema:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:28: in get_schema_content
| content, _ = get_schema(version)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:24: in get_schema
| return FilePathReader(schema_path_full).read()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/readers.py:37: in read
| return all_urls_handler(uri), uri
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:45: in __call__
| return self._open(uri)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/urllib.py:18: in _open
| return super().__call__(fh)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:41: in __call__
| parsed_url = urlparse(uri)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:394: in urlparse
| url, scheme, _coerce_result = _coerce_args(url, scheme)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:133: in _coerce_args
| return _decode_args(args) + (_encode_result,)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in _decode_args
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in <genexpr>
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
| self = <addinfourl at 140561956106416 whose fp = <_io.BufferedReader name='/root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/resources/schemas/v3.0/schema.json'>>
| name = 'decode'
|
| def __getattr__(self, name):
| # Attribute lookups are delegated to the underlying file
| # and cached for non-numeric results
| # (i.e. methods are cached, closed and friends are not)
| file = self.__dict__['file']
| > a = getattr(file, name)
| E AttributeError: '_io.BufferedReader' object has no attribute 'decode'
|
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/tempfile.py:494: AttributeError
| _ TestOpenApiEndpointAdapter.TestWhenAdaptingPetstoreSwaggerIo.test_adapt_from_file _
|
| self = <openapi_endpoint_adapter_test.TestOpenApiEndpointAdapter.TestWhenAdaptingPetstoreSwaggerIo object at 0x7fd721e77bf0>
| open_api_endpoint_adapter = <stoobly_agent.app.cli.helpers.openapi_endpoint_adapter.OpenApiEndpointAdapter object at 0x7fd721765130>
| petstore_swagger_io_file_path = PosixPath('/home/user/folder/stoobly-agent/stoobly_agent/test/mock_data/petstore-swagger-io.yaml')
| expected_put_v3_pets_ref = {'body_param_names': [{'body_param_name_id': None, 'endpoint_id': 1, 'id': 1, 'inferred_type': 'Integer', ...}, {'body...'endpoint_id': 1, 'id': 6, 'inferred_type': 'Array', ...}, ...], 'host': '-', 'id': 1, 'match_pattern': '/v3/pet', ...}
| expected_post_v3_user_createwithlist = {'body_param_names': [{'body_param_name_id': None, 'endpoint_id': 14, 'id': 1, 'inferred_type': 'Hash', ...}, {'body_p...'id': 6, 'inferred_type': 'String', ...}, ...], 'host': '-', 'id': 14, 'match_pattern': '/v3/user/createWithList', ...}
|
| def test_adapt_from_file(self, open_api_endpoint_adapter, petstore_swagger_io_file_path, expected_put_v3_pets_ref, expected_post_v3_user_createwithlist):
| adapter = open_api_endpoint_adapter
| file_path = petstore_swagger_io_file_path
|
| > endpoints = adapter.adapt_from_file(file_path)
|
| stoobly_agent/test/app/cli/helpers/openapi_endpoint_adapter_test.py:1304:
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
| stoobly_agent/app/cli/helpers/openapi_endpoint_adapter.py:38: in adapt_from_file
| spec = Spec.from_dict(file_data)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_core/spec/paths.py:56: in from_dict
| validator.validate(data, spec_url=spec_url)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/proxies.py:27: in validate
| for err in validator.iter_errors(instance, spec_url=spec_url):
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/decorators.py:22: in wrapper
| for err in errors:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/validation/validators.py:89: in iter_errors
| yield from self.schema_validator.iter_errors(instance)
| <attrs generated init jsonschema.validators.create.<locals>.Validator>:5: in __init__
| self.__attrs_post_init__()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:216: in __attrs_post_init__
| self.resolver = RefResolver.from_schema(
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/validators.py:772: in from_schema
| return cls(base_uri=id_of(schema), referrer=schema, *args, **kwargs) # noqa: B026, E501
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema/_legacy_validators.py:12: in id_of
| if schema is True or schema is False or "$ref" in schema:
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:28: in get_schema_content
| content, _ = get_schema(version)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/schemas/utils.py:24: in get_schema
| return FilePathReader(schema_path_full).read()
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/readers.py:37: in read
| return all_urls_handler(uri), uri
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:45: in __call__
| return self._open(uri)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/urllib.py:18: in _open
| return super().__call__(fh)
| /root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/jsonschema_spec/handlers/file.py:41: in __call__
| parsed_url = urlparse(uri)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:394: in urlparse
| url, scheme, _coerce_result = _coerce_args(url, scheme)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:133: in _coerce_args
| return _decode_args(args) + (_encode_result,)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in _decode_args
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/urllib/parse.py:117: in <genexpr>
| return tuple(x.decode(encoding, errors) if x else '' for x in args)
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
| self = <addinfourl at 140561955945792 whose fp = <_io.BufferedReader name='/root/.cache/pypoetry/virtualenvs/stoobly-agent-TgmRXocL-py3.12/lib/python3.12/site-packages/openapi_spec_validator/resources/schemas/v3.0/schema.json'>>
| name = 'decode'
|
| def __getattr__(self, name):
| # Attribute lookups are delegated to the underlying file
| # and cached for non-numeric results
| # (i.e. methods are cached, closed and friends are not)
| file = self.__dict__['file']
| > a = getattr(file, name)
| E AttributeError: '_io.BufferedReader' object has no attribute 'decode'
|
| /opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/tempfile.py:494: AttributeError
Do this after https://github.com/Stoobly/stoobly-agent/issues/243