Skip to content

Commit

Permalink
Correct test logic
Browse files Browse the repository at this point in the history
  • Loading branch information
superbuggy committed Dec 13, 2024
1 parent 7a52b45 commit 192070c
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions osidb/tests/endpoints/flaws/test_unembargo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import datetime, timezone
from itertools import chain

import pghistory
import pytest
from django.conf import settings
from freezegun import freeze_time
Expand Down Expand Up @@ -162,25 +163,30 @@ def test_complex(self, auth_client, test_api_uri):
HTTP_JIRA_API_KEY="SECRET",
)
assert response.status_code == status.HTTP_200_OK
models = [
Flaw,
FlawAcknowledgment,
FlawComment,
FlawCVSS,
FlawReference,
Affect,
AffectCVSS,
Package,
Tracker,
]
assert not any(
instance.is_embargoed
for instance in chain(
Flaw.objects.all(),
FlawAcknowledgment.objects.all(),
FlawComment.objects.all(),
FlawCVSS.objects.all(),
FlawReference.objects.all(),
Affect.objects.all(),
AffectCVSS.objects.all(),
Package.objects.all(),
Tracker.objects.all(),
)
for instance in chain(*[model.objects.all() for model in models])
)

audit_models = [
pghistory.models.Events.objects.references(model).all()
for model in models
]
assert (
flaw["acls_read"] == settings.PUBLIC_READ_GROUPS
and flaw["acls_write"] == [settings.PUBLIC_WRITE_GROUP]
for flaw in Flaw.objects.all()
audit_model["acls_read"] == settings.PUBLIC_READ_GROUPS
and audit_model["acls_write"] == [settings.PUBLIC_WRITE_GROUP]
for audit_model in audit_models
)

@freeze_time(datetime(2020, 10, 10, tzinfo=timezone.utc))
Expand Down

0 comments on commit 192070c

Please sign in to comment.