Apply Ocean version 0.13.0 to all integrations #4995
GitHub Actions / JUnit Test Report
failed
Nov 10, 2024 in 0s
3 tests run, 1 passed, 0 skipped, 2 failed.
Annotations
Check failure on line 32 in integrations/fake-integration/tests/test_sync.py
github-actions / JUnit Test Report
test_sync.test_full_sync_with_http_mock
assert 1 == 0
+ where 1 = len([OceanAbortException("Failed to execute resync function, error: No response can be found for GET request on http://localhost:8000/integration/department/finance/employees/2 with {'User-Agent': 'Ocean Framework Fake Integration (https://github.com/port-labs/ocean)'} headers amongst:\n- Already matched any request with {'User-Agent': 'Ocean Framework Fake Integration (https://github.com/port-labs/ocean)'} headers\n\nIf you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request")])
Raw output
get_mocked_ocean_app = <function get_mocked_ocean_app.<locals>.get_ocean_app at 0x7f638a4ceac0>
get_mock_ocean_resource_configs = <function get_mock_ocean_resource_configs.<locals>.get_ocean_resource_configs at 0x7f638a4cea20>
httpx_mock = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f638a4bb170>
async def test_full_sync_with_http_mock(
get_mocked_ocean_app: Any,
get_mock_ocean_resource_configs: Any,
httpx_mock: HTTPXMock,
) -> None:
httpx_mock.add_response(
match_headers={"User-Agent": USER_AGENT},
json={
"results": [
FAKE_PERSON_RAW,
]
},
)
app = get_mocked_ocean_app()
resource_configs = get_mock_ocean_resource_configs()
for resource_config in resource_configs:
results = await get_raw_result_on_integration_sync_resource_config(
app, resource_config
)
> assert_on_results(results, resource_config.kind)
tests/test_sync.py:62:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
results = ([], [OceanAbortException("Failed to execute resync function, error: No response can be found for GET request on http:...ttps://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request")])
kind = 'fake-person'
def assert_on_results(results: Any, kind: str) -> None:
assert len(results) > 0
entities, errors = results
> assert len(errors) == 0
E assert 1 == 0
E + where 1 = len([OceanAbortException("Failed to execute resync function, error: No response can be found for GET request on http://localhost:8000/integration/department/finance/employees/2 with {'User-Agent': 'Ocean Framework Fake Integration (https://github.com/port-labs/ocean)'} headers amongst:\n- Already matched any request with {'User-Agent': 'Ocean Framework Fake Integration (https://github.com/port-labs/ocean)'} headers\n\nIf you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request")])
tests/test_sync.py:32: AssertionError
Check failure on line 1 in integrations/fake-integration/tests/test_sync.py
github-actions / JUnit Test Report
test_sync.test_full_sync_with_http_mock
failed on teardown with "AssertionError: The following requests were not expected:
- GET request on http://localhost:8000/integration/department/marketing/employees/18
- GET request on http://localhost:8000/integration/department/finance/employees/2
- GET request on http://localhost:8000/integration/department/support/employees/8
- GET request on http://localhost:8000/integration/department/morpazia/employees/10
- GET request on http://localhost:8000/integration/department/marketing/employees/18
- GET request on http://localhost:8000/integration/department/finance/employees/2
- GET request on http://localhost:8000/integration/department/support/employees/8
- GET request on http://localhost:8000/integration/department/morpazia/employees/10
- GET request on http://localhost:8000/integration/department/marketing/employees/18
- GET request on http://localhost:8000/integration/department/support/employees/8
- GET request on http://localhost:8000/integration/department/morpazia/employees/10
- GET request on http://localhost:8000/integration/department/finance/employees/2
- GET request on http://localhost:8000/integration/department/support/employees/8
- GET request on http://localhost:8000/integration/department/marketing/employees/18
- GET request on http://localhost:8000/integration/department/morpazia/employees/10
- GET request on http://localhost:8000/integration/department/finance/employees/2
- GET request on http://localhost:8000/integration/department/support/employees/8
- GET request on http://localhost:8000/integration/department/morpazia/employees/10
- GET request on http://localhost:8000/integration/department/finance/employees/2
- GET request on http://localhost:8000/integration/department/marketing/employees/18
- GET request on http://localhost:8000/integration/department/support/employees/8
- GET request on http://localhost:8000/integration/department/marketing/employees/18
- GET request on http://localhost:8000/integration/department/morpazia/employees/10
- GET request on http://localhost:8000/integration/department/finance/employees/2
- GET request on http://localhost:8000/integration/department/support/employees/8
- GET request on http://localhost:8000/integration/department/marketing/employees/18
- GET request on http://localhost:8000/integration/department/morpazia/employees/10
- GET request on http://localhost:8000/integration/department/finance/employees/2
- GET request on http://localhost:8000/integration/department/support/employees/8
- GET request on http://localhost:8000/integration/department/morpazia/employees/10
- GET request on http://localhost:8000/integration/department/marketing/employees/18
- GET request on http://localhost:8000/integration/department/finance/employees/2
- GET request on http://localhost:8000/integration/department/support/employees/8
- GET request on http://localhost:8000/integration/department/finance/employees/2
- GET request on http://localhost:8000/integration/department/morpazia/employees/10
- GET request on http://localhost:8000/integration/department/marketing/employees/18
- GET request on http://localhost:8000/integration/department/finance/employees/2
- GET request on http://localhost:8000/integration/department/marketing/employees/18
- GET request on http://localhost:8000/integration/department/support/employees/8
- GET request on http://localhost:8000/integration/department/morpazia/employees/10
- GET request on http://localhost:8000/integration/department/finance/employees/2
If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-not-register-responses-for-every-request
assert not [<Request('GET', 'http://localhost:8000/integration/department/marketing/employees/18')>, <Request('GET', 'http://localhost:8000/integration/department/finance/employees/2')>, <Request('GET', 'http://localhost:8000/integration/department/support/employees/8')>, <Request('GET', 'http://localhost:8000/integration/department/morpazia/employees/10')>, <Request('GET', 'http://localhost:8000/integration/department/marketing/employees/18')>, <Request('GET', 'http://localhost:8000/integration/department/finance/employees/2')>, ...]
+ where [<Request('GET', 'http://localhost:8000/integration/department/marketing/employees/18')>, <Request('GET', 'http://localhost:8000/integration/department/finance/employees/2')>, <Request('GET', 'http://localhost:8000/integration/department/support/employees/8')>, <Request('GET', 'http://localhost:8000/integration/department/morpazia/employees/10')>, <Request('GET', 'http://localhost:8000/integration/department/marketing/employees/18')>, <Request('GET', 'http://localhost:8000/integration/department/finance/employees/2')>, ...] = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f638a4bb170>._requests_not_matched"
Raw output
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f638b21ce90>
request = <SubRequest 'httpx_mock' for <Coroutine test_full_sync_with_http_mock>>
@pytest.fixture
def httpx_mock(
monkeypatch: MonkeyPatch,
request: FixtureRequest,
) -> Generator[HTTPXMock, None, None]:
options = {}
for marker in request.node.iter_markers("httpx_mock"):
options = marker.kwargs | options
__tracebackhide__ = methodcaller("errisinstance", TypeError)
options = _HTTPXMockOptions(**options)
mock = HTTPXMock(options)
# Mock synchronous requests
real_handle_request = httpx.HTTPTransport.handle_request
def mocked_handle_request(
transport: httpx.HTTPTransport, request: httpx.Request
) -> httpx.Response:
if options.should_mock(request):
return mock._handle_request(transport, request)
return real_handle_request(transport, request)
monkeypatch.setattr(
httpx.HTTPTransport,
"handle_request",
mocked_handle_request,
)
# Mock asynchronous requests
real_handle_async_request = httpx.AsyncHTTPTransport.handle_async_request
async def mocked_handle_async_request(
transport: httpx.AsyncHTTPTransport, request: httpx.Request
) -> httpx.Response:
if options.should_mock(request):
return await mock._handle_async_request(transport, request)
return await real_handle_async_request(transport, request)
monkeypatch.setattr(
httpx.AsyncHTTPTransport,
"handle_async_request",
mocked_handle_async_request,
)
yield mock
try:
> mock._assert_options()
.venv/lib/python3.12/site-packages/pytest_httpx/__init__.py:67:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f638a4bb170>
def _assert_options(self) -> None:
if self._options.assert_all_responses_were_requested:
callbacks_not_executed = [
matcher for matcher, _ in self._callbacks if not matcher.nb_calls
]
matchers_description = "\n".join(
[f"- {matcher}" for matcher in callbacks_not_executed]
)
assert not callbacks_not_executed, (
"The following responses are mocked but not requested:\n"
f"{matchers_description}\n"
"\n"
"If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-more-responses-than-what-will-be-requested"
)
if self._options.assert_all_requests_were_expected:
requests_description = "\n".join(
[
f"- {request.method} request on {request.url}"
for request in self._requests_not_matched
]
)
> assert not self._requests_not_matched, (
f"The following requests were not expected:\n"
f"{requests_description}\n"
"\n"
"If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-not-register-responses-for-every-request"
)
E AssertionError: The following requests were not expected:
E - GET request on http://localhost:8000/integration/department/marketing/employees/18
E - GET request on http://localhost:8000/integration/department/finance/employees/2
E - GET request on http://localhost:8000/integration/department/support/employees/8
E - GET request on http://localhost:8000/integration/department/morpazia/employees/10
E - GET request on http://localhost:8000/integration/department/marketing/employees/18
E - GET request on http://localhost:8000/integration/department/finance/employees/2
E - GET request on http://localhost:8000/integration/department/support/employees/8
E - GET request on http://localhost:8000/integration/department/morpazia/employees/10
E - GET request on http://localhost:8000/integration/department/marketing/employees/18
E - GET request on http://localhost:8000/integration/department/support/employees/8
E - GET request on http://localhost:8000/integration/department/morpazia/employees/10
E - GET request on http://localhost:8000/integration/department/finance/employees/2
E - GET request on http://localhost:8000/integration/department/support/employees/8
E - GET request on http://localhost:8000/integration/department/marketing/employees/18
E - GET request on http://localhost:8000/integration/department/morpazia/employees/10
E - GET request on http://localhost:8000/integration/department/finance/employees/2
E - GET request on http://localhost:8000/integration/department/support/employees/8
E - GET request on http://localhost:8000/integration/department/morpazia/employees/10
E - GET request on http://localhost:8000/integration/department/finance/employees/2
E - GET request on http://localhost:8000/integration/department/marketing/employees/18
E - GET request on http://localhost:8000/integration/department/support/employees/8
E - GET request on http://localhost:8000/integration/department/marketing/employees/18
E - GET request on http://localhost:8000/integration/department/morpazia/employees/10
E - GET request on http://localhost:8000/integration/department/finance/employees/2
E - GET request on http://localhost:8000/integration/department/support/employees/8
E - GET request on http://localhost:8000/integration/department/marketing/employees/18
E - GET request on http://localhost:8000/integration/department/morpazia/employees/10
E - GET request on http://localhost:8000/integration/department/finance/employees/2
E - GET request on http://localhost:8000/integration/department/support/employees/8
E - GET request on http://localhost:8000/integration/department/morpazia/employees/10
E - GET request on http://localhost:8000/integration/department/marketing/employees/18
E - GET request on http://localhost:8000/integration/department/finance/employees/2
E - GET request on http://localhost:8000/integration/department/support/employees/8
E - GET request on http://localhost:8000/integration/department/finance/employees/2
E - GET request on http://localhost:8000/integration/department/morpazia/employees/10
E - GET request on http://localhost:8000/integration/department/marketing/employees/18
E - GET request on http://localhost:8000/integration/department/finance/employees/2
E - GET request on http://localhost:8000/integration/department/marketing/employees/18
E - GET request on http://localhost:8000/integration/department/support/employees/8
E - GET request on http://localhost:8000/integration/department/morpazia/employees/10
E - GET request on http://localhost:8000/integration/department/finance/employees/2
E
E If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-not-register-responses-for-every-request
E assert not [<Request('GET', 'http://localhost:8000/integration/department/marketing/employees/18')>, <Request('GET', 'http://localhost:8000/integration/department/finance/employees/2')>, <Request('GET', 'http://localhost:8000/integration/department/support/employees/8')>, <Request('GET', 'http://localhost:8000/integration/department/morpazia/employees/10')>, <Request('GET', 'http://localhost:8000/integration/department/marketing/employees/18')>, <Request('GET', 'http://localhost:8000/integration/department/finance/employees/2')>, ...]
E + where [<Request('GET', 'http://localhost:8000/integration/department/marketing/employees/18')>, <Request('GET', 'http://localhost:8000/integration/department/finance/employees/2')>, <Request('GET', 'http://localhost:8000/integration/department/support/employees/8')>, <Request('GET', 'http://localhost:8000/integration/department/morpazia/employees/10')>, <Request('GET', 'http://localhost:8000/integration/department/marketing/employees/18')>, <Request('GET', 'http://localhost:8000/integration/department/finance/employees/2')>, ...] = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f638a4bb170>._requests_not_matched
.venv/lib/python3.12/site-packages/pytest_httpx/_httpx_mock.py:329: AssertionError
Loading