Skip to content

Commit 9411b33

Browse files
committed
Add OIDC ActiveStatePublisher modeling
1 parent 84cdb92 commit 9411b33

File tree

11 files changed

+838
-1
lines changed

11 files changed

+838
-1
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
@@ -375,6 +375,18 @@ def oidc_service(db_session):
375375
)
376376

377377

378+
# @pytest.fixture
379+
# def activestate_oidc_service(db_session):
380+
# return oidc_services.NullOIDCPublisherService(
381+
# db_session,
382+
# pretend.stub(),
383+
# ACTIVESTATE_OIDC_ISSUER_URL,
384+
# pretend.stub(),
385+
# pretend.stub(),
386+
# pretend.stub(),
387+
# )
388+
389+
378390
@pytest.fixture
379391
def macaroon_service(db_session):
380392
return macaroon_services.DatabaseMacaroonService(db_session)

0 commit comments

Comments
 (0)