Skip to content

Commit e71a327

Browse files
committed
Add OIDC ActiveStatePublisher modeling
1 parent 04fa637 commit e71a327

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
@@ -13,8 +13,10 @@
1313
import factory
1414

1515
from warehouse.oidc.models import (
16+
ActiveStatePublisher,
1617
GitHubPublisher,
1718
GooglePublisher,
19+
PendingActiveStatePublisher,
1820
PendingGitHubPublisher,
1921
PendingGooglePublisher,
2022
)
@@ -67,3 +69,37 @@ class Meta:
6769
email = factory.Faker("safe_email")
6870
sub = factory.Faker("pystr", max_chars=12)
6971
added_by = factory.SubFactory(UserFactory)
72+
73+
74+
class ActiveStatePublisherFactory(WarehouseFactory):
75+
class Meta:
76+
model = ActiveStatePublisher
77+
78+
id = factory.Faker("uuid4", cast_to=None)
79+
sub = factory.Faker("pystr", max_chars=12)
80+
organization_id = factory.Faker("uuid4")
81+
organization_url_name = factory.Faker("pystr", max_chars=12)
82+
project_id = factory.Faker("uuid4")
83+
activestate_project_name = factory.Faker("pystr", max_chars=12)
84+
project_path = f"{organization_url_name}/{activestate_project_name}"
85+
user_id = factory.Faker("uuid4")
86+
branch_id = factory.Faker("uuid4")
87+
project_visibility = factory.Faker("random_element", elements=[True, False])
88+
sub = factory.Faker("pystr", max_chars=12)
89+
90+
91+
class PendingActiveStatePublisherFactory(WarehouseFactory):
92+
class Meta:
93+
model = PendingActiveStatePublisher
94+
95+
id = factory.Faker("uuid4", cast_to=None)
96+
sub = factory.Faker("pystr", max_chars=12)
97+
project_name = factory.Faker("pystr", max_chars=12)
98+
organization_id = factory.Faker("uuid4")
99+
organization_url_name = factory.Faker("pystr", max_chars=12)
100+
project_id = factory.Faker("uuid4")
101+
activestate_project_name = factory.Faker("pystr", max_chars=12)
102+
project_path = f"{organization_url_name}/{activestate_project_name}"
103+
user_id = factory.Faker("uuid4")
104+
project_visibility = factory.Faker("random_element", elements=[True, False])
105+
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)