Skip to content

Commit 29d1249

Browse files
committed
Add OIDC ActiveStatePublisher modeling
1 parent d571642 commit 29d1249

File tree

11 files changed

+848
-3
lines changed

11 files changed

+848
-3
lines changed

tests/common/db/oidc.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
import pretend
1515

1616
from warehouse.oidc.models import (
17+
ActiveStatePublisher,
1718
GitHubPublisher,
1819
GooglePublisher,
1920
OIDCPublisher,
21+
PendingActiveStatePublisher,
2022
PendingGitHubPublisher,
2123
PendingGooglePublisher,
2224
PendingOIDCPublisher,
@@ -86,3 +88,37 @@ class Meta:
8688
email = factory.Faker("safe_email")
8789
sub = factory.Faker("pystr", max_chars=12)
8890
added_by = factory.SubFactory(UserFactory)
91+
92+
93+
class ActiveStatePublisherFactory(WarehouseFactory):
94+
class Meta:
95+
model = ActiveStatePublisher
96+
97+
id = factory.Faker("uuid4", cast_to=None)
98+
sub = factory.Faker("pystr", max_chars=12)
99+
organization_id = factory.Faker("uuid4")
100+
organization_url_name = factory.Faker("pystr", max_chars=12)
101+
project_id = factory.Faker("uuid4")
102+
activestate_project_name = factory.Faker("pystr", max_chars=12)
103+
project_path = f"{organization_url_name}/{activestate_project_name}"
104+
user_id = factory.Faker("uuid4")
105+
branch_id = factory.Faker("uuid4")
106+
project_visibility = factory.Faker("random_element", elements=[True, False])
107+
sub = factory.Faker("pystr", max_chars=12)
108+
109+
110+
class PendingActiveStatePublisherFactory(WarehouseFactory):
111+
class Meta:
112+
model = PendingActiveStatePublisher
113+
114+
id = factory.Faker("uuid4", cast_to=None)
115+
sub = factory.Faker("pystr", max_chars=12)
116+
project_name = factory.Faker("pystr", max_chars=12)
117+
organization_id = factory.Faker("uuid4")
118+
organization_url_name = factory.Faker("pystr", max_chars=12)
119+
project_id = factory.Faker("uuid4")
120+
activestate_project_name = factory.Faker("pystr", max_chars=12)
121+
project_path = f"{organization_url_name}/{activestate_project_name}"
122+
user_id = factory.Faker("uuid4")
123+
project_visibility = factory.Faker("random_element", elements=[True, False])
124+
added_by = factory.SubFactory(UserFactory)

tests/conftest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,18 @@ def oidc_service(db_session):
351351
)
352352

353353

354+
# @pytest.fixture
355+
# def activestate_oidc_service(db_session):
356+
# return oidc_services.NullOIDCPublisherService(
357+
# db_session,
358+
# pretend.stub(),
359+
# ACTIVESTATE_OIDC_ISSUER_URL,
360+
# pretend.stub(),
361+
# pretend.stub(),
362+
# pretend.stub(),
363+
# )
364+
365+
354366
@pytest.fixture
355367
def macaroon_service(db_session):
356368
return macaroon_services.DatabaseMacaroonService(db_session)

0 commit comments

Comments
 (0)