Created
June 28, 2025 10:50
-
-
Save tanvirraj/3e9f8e9c0e5f353cdebce4f1c41c2769 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[gw0] darwin -- Python 3.12.7 /Users/tanvirraj/code/buttondown/monorepo/app/.venv/bin/python3 | |
newsletter = <Newsletter: 0943bb89-1294-4c80-bf35-26ceef50dd12>, snapshot = <pytest_snapshot.plugin.Snapshot object at 0x12ff8ec90> | |
def test_email_history_detail(newsletter, snapshot) -> None: | |
with time_machine.travel("2020-01-01", tick=False): | |
email = FakeData.email(newsletter=newsletter, body="Old body") | |
with time_machine.travel("2020-02-01", tick=False): | |
email.body = "New body" | |
email.save() | |
> assert_snapshot( | |
newsletter, | |
snapshot, | |
f"/v1/emails/{email.id}/history/body/{email.history.all().order_by('modification_date').latest().history_id}", | |
"email_history_detail.json", | |
) | |
api/views/emails/routes--test.py:100: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
api/tests/snapshots/test_snapshots.py:136: in assert_snapshot | |
response = getattr(client, method)(path) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
.venv/lib/python3.12/site-packages/django/test/client.py:1129: in get | |
response = super().get( | |
.venv/lib/python3.12/site-packages/django/test/client.py:479: in get | |
return self.generic( | |
.venv/lib/python3.12/site-packages/django/test/client.py:676: in generic | |
return self.request(**r) | |
^^^^^^^^^^^^^^^^^ | |
.venv/lib/python3.12/site-packages/django/test/client.py:1092: in request | |
self.check_exception(response) | |
.venv/lib/python3.12/site-packages/django/test/client.py:805: in check_exception | |
raise exc_value | |
.venv/lib/python3.12/site-packages/django/core/handlers/exception.py:55: in inner | |
response = get_response(request) | |
^^^^^^^^^^^^^^^^^^^^^ | |
.venv/lib/python3.12/site-packages/django/core/handlers/base.py:197: in _get_response | |
response = wrapped_callback(request, *callback_args, **callback_kwargs) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
.venv/lib/python3.12/site-packages/ninja/operation.py:339: in _sync_view | |
return operation.run(request, *a, **kw) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
.venv/lib/python3.12/site-packages/ninja/operation.py:106: in run | |
return self.api.on_exception(request, e) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
.venv/lib/python3.12/site-packages/ninja/main.py:453: in on_exception | |
return handler(request, exc) | |
^^^^^^^^^^^^^^^^^^^^^ | |
.venv/lib/python3.12/site-packages/ninja/errors.py:104: in _default_exception | |
raise exc # let django deal with it | |
^^^^^^^^^ | |
.venv/lib/python3.12/site-packages/ninja/operation.py:99: in run | |
result = self.view_func(request, **values) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
api/views/emails/routes.py:700: in retrieve_email_history_by_id | |
code, entry = generics.retrieve( | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
request = <WSGIRequest: GET '/v1/emails/d5d97f97-9fe6-4f02-bc33-f11f04d51fc6/history/body/11447'> | |
class_type = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object at 0x12ff92d80>, id = UUID('d5d97f97-9fe6-4f02-bc33-f11f04d51fc6') | |
query_filter = <Q: (AND: ('history_id', 11447))> | |
def retrieve( | |
request, class_type: type[Model], id: str | UUID, query_filter: Q | None = None | |
): | |
r = check_for_billing(request) | |
if r: | |
return r | |
q = query_filter or Q(id=convert_typeid_to_uuid(id)) | |
> instance = class_type.objects.filter( | |
^^^^^^^^^^^^^^^^^^ | |
q, **filter_for_type(request, class_type) | |
).first() | |
E AttributeError: 'HistoryManagerFromHistoricalQuerySet' object has no attribute 'objects' | |
api/views/generics.py:231: AttributeError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment