|
27 | 27 |
|
28 | 28 | class TestManageOIDCPublisherViews: |
29 | 29 | def test_initializes(self, metrics): |
30 | | - project = pretend.stub() |
| 30 | + project = pretend.stub(organization=None) |
31 | 31 | request = pretend.stub( |
32 | 32 | find_service=pretend.call_recorder(lambda *a, **kw: metrics), |
33 | 33 | registry=pretend.stub( |
@@ -56,7 +56,7 @@ def test_initializes(self, metrics): |
56 | 56 | ], |
57 | 57 | ) |
58 | 58 | def test_ratelimiting(self, metrics, ip_exceeded, user_exceeded): |
59 | | - project = pretend.stub() |
| 59 | + project = pretend.stub(organization=None) |
60 | 60 | user_rate_limiter = pretend.stub( |
61 | 61 | hit=pretend.call_recorder(lambda *a, **kw: None), |
62 | 62 | test=pretend.call_recorder(lambda uid: not user_exceeded), |
@@ -115,7 +115,7 @@ def find_service(iface, name=None, context=None): |
115 | 115 | view._check_ratelimits() |
116 | 116 |
|
117 | 117 | def test_manage_project_oidc_publishers(self, monkeypatch): |
118 | | - project = pretend.stub(oidc_publishers=[]) |
| 118 | + project = pretend.stub(oidc_publishers=[], organization=None) |
119 | 119 | request = pretend.stub( |
120 | 120 | user=pretend.stub(), |
121 | 121 | registry=pretend.stub( |
@@ -157,7 +157,7 @@ def test_manage_project_oidc_publishers(self, monkeypatch): |
157 | 157 | def test_manage_project_oidc_publishers_admin_disabled( |
158 | 158 | self, monkeypatch, pyramid_request |
159 | 159 | ): |
160 | | - project = pretend.stub(oidc_publishers=[]) |
| 160 | + project = pretend.stub(oidc_publishers=[], organization=None) |
161 | 161 | pyramid_request.user = pretend.stub() |
162 | 162 | pyramid_request.registry = pretend.stub( |
163 | 163 | settings={ |
@@ -230,6 +230,7 @@ def test_manage_project_oidc_publishers_admin_disabled( |
230 | 230 | "project": "repo", |
231 | 231 | "workflow_filepath": "file.yml", |
232 | 232 | "environment": "my_env", |
| 233 | + "issuer_url": "https://gitlab.com", |
233 | 234 | }, |
234 | 235 | ), |
235 | 236 | # All fields of Google provider |
@@ -267,7 +268,7 @@ def test_manage_project_oidc_publishers_admin_disabled( |
267 | 268 | def test_manage_project_oidc_publishers_prefill( |
268 | 269 | self, monkeypatch, form_name, prefilled_data |
269 | 270 | ): |
270 | | - project = pretend.stub(oidc_publishers=[]) |
| 271 | + project = pretend.stub(oidc_publishers=[], organization=None) |
271 | 272 | request = pretend.stub( |
272 | 273 | user=pretend.stub(), |
273 | 274 | registry=pretend.stub( |
@@ -350,7 +351,7 @@ def test_manage_project_oidc_publishers_prefill( |
350 | 351 | def test_manage_project_oidc_publishers_prefill_partial( |
351 | 352 | self, monkeypatch, missing_fields, prefilled_data, extra_fields |
352 | 353 | ): |
353 | | - project = pretend.stub(oidc_publishers=[]) |
| 354 | + project = pretend.stub(oidc_publishers=[], organization=None) |
354 | 355 | request = pretend.stub( |
355 | 356 | user=pretend.stub(), |
356 | 357 | registry=pretend.stub( |
@@ -396,7 +397,7 @@ def test_manage_project_oidc_publishers_prefill_partial( |
396 | 397 | assert view.github_publisher_form.data == expected_data |
397 | 398 |
|
398 | 399 | def test_manage_project_oidc_publishers_prefill_unknown_provider(self, monkeypatch): |
399 | | - project = pretend.stub(oidc_publishers=[]) |
| 400 | + project = pretend.stub(oidc_publishers=[], organization=None) |
400 | 401 | prefilled_data = { |
401 | 402 | "provider": "github2", |
402 | 403 | "owner": "owner", |
@@ -649,7 +650,7 @@ def test_manage_project_oidc_publishers_constrain_environment_shared_publisher( |
649 | 650 | ] |
650 | 651 |
|
651 | 652 | def test_constrain_oidc_publisher_admin_disabled(self, monkeypatch): |
652 | | - project = pretend.stub() |
| 653 | + project = pretend.stub(organization=None) |
653 | 654 | request = pretend.stub( |
654 | 655 | method="POST", |
655 | 656 | params=MultiDict(), |
@@ -687,7 +688,7 @@ def test_constrain_oidc_publisher_admin_disabled(self, monkeypatch): |
687 | 688 | ] |
688 | 689 |
|
689 | 690 | def test_constrain_oidc_publisher_invalid_params(self, monkeypatch, metrics): |
690 | | - project = pretend.stub() |
| 691 | + project = pretend.stub(organization=None) |
691 | 692 | request = pretend.stub( |
692 | 693 | method="POST", |
693 | 694 | params=MultiDict(), |
@@ -727,7 +728,7 @@ def test_constrain_oidc_publisher_invalid_params(self, monkeypatch, metrics): |
727 | 728 | def test_constrain_non_extant_oidc_publisher( |
728 | 729 | self, monkeypatch, metrics, db_request |
729 | 730 | ): |
730 | | - project = pretend.stub() |
| 731 | + project = pretend.stub(organization=None) |
731 | 732 | db_request.method = "POST" |
732 | 733 | db_request.POST = MultiDict( |
733 | 734 | { |
@@ -1051,6 +1052,7 @@ def test_constrain_environment_publisher_already_exists( |
1051 | 1052 | namespace=pretend.stub(data=publisher.namespace), |
1052 | 1053 | workflow_filepath=pretend.stub(data=publisher.workflow_filepath), |
1053 | 1054 | normalized_environment=publisher.environment, |
| 1055 | + issuer_url=pretend.stub(data="https://gitlab.com"), |
1054 | 1056 | ), |
1055 | 1057 | ), |
1056 | 1058 | ( |
@@ -1100,6 +1102,7 @@ def test_add_oidc_publisher_preexisting( |
1100 | 1102 | project = pretend.stub( |
1101 | 1103 | name="fakeproject", |
1102 | 1104 | oidc_publishers=[], |
| 1105 | + organization=None, |
1103 | 1106 | record_event=pretend.call_recorder(lambda *a, **kw: None), |
1104 | 1107 | users=[], |
1105 | 1108 | ) |
@@ -1210,6 +1213,7 @@ def test_add_oidc_publisher_preexisting( |
1210 | 1213 | namespace=pretend.stub(data="fakeowner"), |
1211 | 1214 | workflow_filepath=pretend.stub(data="subfolder/fakeworkflow.yml"), |
1212 | 1215 | normalized_environment="some-environment", |
| 1216 | + issuer_url=pretend.stub(data="https://gitlab.com"), |
1213 | 1217 | ), |
1214 | 1218 | pretend.stub(publisher_name="GitLab"), |
1215 | 1219 | ), |
@@ -1245,6 +1249,7 @@ def test_add_oidc_publisher_created( |
1245 | 1249 | project = pretend.stub( |
1246 | 1250 | name="fakeproject", |
1247 | 1251 | oidc_publishers=[], |
| 1252 | + organization=None, |
1248 | 1253 | record_event=pretend.call_recorder(lambda *a, **kw: None), |
1249 | 1254 | users=[fakeuser], |
1250 | 1255 | ) |
@@ -1385,6 +1390,7 @@ def test_add_oidc_publisher_created( |
1385 | 1390 | "project": "some-repository", |
1386 | 1391 | "workflow_filepath": "subfolder/some-workflow-filename.yml", |
1387 | 1392 | "environment": "some-environment", |
| 1393 | + "issuer_url": "https://gitlab.com", |
1388 | 1394 | } |
1389 | 1395 | ), |
1390 | 1396 | ), |
@@ -1432,6 +1438,7 @@ def test_add_oidc_publisher_already_registered_with_project( |
1432 | 1438 | project = pretend.stub( |
1433 | 1439 | name="fakeproject", |
1434 | 1440 | oidc_publishers=[publisher], |
| 1441 | + organization=None, |
1435 | 1442 | record_event=pretend.call_recorder(lambda *a, **kw: None), |
1436 | 1443 | ) |
1437 | 1444 |
|
@@ -1528,6 +1535,7 @@ def test_add_oidc_publisher_already_registered_after_normalization( |
1528 | 1535 | project = pretend.stub( |
1529 | 1536 | name="fakeproject", |
1530 | 1537 | oidc_publishers=[publisher], |
| 1538 | + organization=None, |
1531 | 1539 | record_event=pretend.call_recorder(lambda *a, **kw: None), |
1532 | 1540 | ) |
1533 | 1541 |
|
@@ -1598,7 +1606,7 @@ def test_add_oidc_publisher_already_registered_after_normalization( |
1598 | 1606 | def test_add_oidc_publisher_ratelimited( |
1599 | 1607 | self, metrics, monkeypatch, view_name, publisher_name |
1600 | 1608 | ): |
1601 | | - project = pretend.stub() |
| 1609 | + project = pretend.stub(organization=None) |
1602 | 1610 |
|
1603 | 1611 | request = pretend.stub( |
1604 | 1612 | user=pretend.stub(), |
@@ -1648,7 +1656,7 @@ def test_add_oidc_publisher_ratelimited( |
1648 | 1656 | def test_add_oidc_publisher_admin_disabled( |
1649 | 1657 | self, monkeypatch, view_name, publisher_name |
1650 | 1658 | ): |
1651 | | - project = pretend.stub() |
| 1659 | + project = pretend.stub(organization=None) |
1652 | 1660 | request = pretend.stub( |
1653 | 1661 | user=pretend.stub(), |
1654 | 1662 | find_service=lambda *a, **kw: None, |
@@ -1691,7 +1699,7 @@ def test_add_oidc_publisher_admin_disabled( |
1691 | 1699 | def test_add_oidc_publisher_invalid_form( |
1692 | 1700 | self, metrics, monkeypatch, view_name, publisher_name |
1693 | 1701 | ): |
1694 | | - project = pretend.stub() |
| 1702 | + project = pretend.stub(organization=None) |
1695 | 1703 | request = pretend.stub( |
1696 | 1704 | user=pretend.stub(), |
1697 | 1705 | find_service=lambda *a, **kw: metrics, |
@@ -1966,7 +1974,7 @@ def test_delete_oidc_publisher_entirely(self, monkeypatch, db_request, publisher |
1966 | 1974 |
|
1967 | 1975 | def test_delete_oidc_publisher_invalid_form(self, metrics, monkeypatch): |
1968 | 1976 | publisher = pretend.stub() |
1969 | | - project = pretend.stub(oidc_publishers=[publisher]) |
| 1977 | + project = pretend.stub(oidc_publishers=[publisher], organization=None) |
1970 | 1978 | request = pretend.stub( |
1971 | 1979 | user=pretend.stub(), |
1972 | 1980 | find_service=lambda *a, **kw: metrics, |
@@ -2020,6 +2028,7 @@ def test_delete_oidc_publisher_not_found( |
2020 | 2028 |
|
2021 | 2029 | project = pretend.stub( |
2022 | 2030 | oidc_publishers=[publisher], |
| 2031 | + organization=None, |
2023 | 2032 | name="fakeproject", |
2024 | 2033 | record_event=pretend.call_recorder(lambda *a, **kw: None), |
2025 | 2034 | ) |
@@ -2074,7 +2083,7 @@ def test_delete_oidc_publisher_not_found( |
2074 | 2083 | assert delete_publisher_form_obj.validate.calls == [pretend.call()] |
2075 | 2084 |
|
2076 | 2085 | def test_delete_oidc_publisher_admin_disabled(self, monkeypatch): |
2077 | | - project = pretend.stub() |
| 2086 | + project = pretend.stub(organization=None) |
2078 | 2087 | request = pretend.stub( |
2079 | 2088 | user=pretend.stub(), |
2080 | 2089 | find_service=lambda *a, **kw: None, |
|
0 commit comments