Merge ~cjwatson/launchpad:remove-oci-recipe-webhooks-enabled-feature-rule into launchpad:master
- Git
- lp:~cjwatson/launchpad
- remove-oci-recipe-webhooks-enabled-feature-rule
- Merge into master
Proposed by
Colin Watson
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | ee95ea5c3d68663a671dd4c9b2c09fe7161485e3 |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:remove-oci-recipe-webhooks-enabled-feature-rule |
Merge into: | launchpad:master |
Diff against target: |
368 lines (+36/-116) 10 files modified
lib/lp/oci/browser/ocirecipe.py (+1/-7) lib/lp/oci/interfaces/ocirecipe.py (+0/-2) lib/lp/oci/subscribers/ocirecipebuild.py (+18/-21) lib/lp/oci/tests/test_ocirecipe.py (+3/-21) lib/lp/oci/tests/test_ocirecipebuild.py (+4/-10) lib/lp/oci/tests/test_ocirecipebuildjob.py (+2/-13) lib/lp/services/webhooks/tests/test_browser.py (+2/-12) lib/lp/services/webhooks/tests/test_job.py (+2/-10) lib/lp/services/webhooks/tests/test_model.py (+2/-10) lib/lp/services/webhooks/tests/test_webservice.py (+2/-10) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jürgen Gmach | Approve | ||
Review via email: mp+437043@code.launchpad.net |
Commit message
Remove oci.recipe.
Description of the change
It's been enabled everywhere for some time.
To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/lib/lp/oci/browser/ocirecipe.py b/lib/lp/oci/browser/ocirecipe.py | |||
2 | index 0b9f4d2..1e5e06e 100644 | |||
3 | --- a/lib/lp/oci/browser/ocirecipe.py | |||
4 | +++ b/lib/lp/oci/browser/ocirecipe.py | |||
5 | @@ -61,7 +61,6 @@ from lp.oci.interfaces.ocipushrule import ( | |||
6 | 61 | ) | 61 | ) |
7 | 62 | from lp.oci.interfaces.ocirecipe import ( | 62 | from lp.oci.interfaces.ocirecipe import ( |
8 | 63 | OCI_RECIPE_ALLOW_CREATE, | 63 | OCI_RECIPE_ALLOW_CREATE, |
9 | 64 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG, | ||
10 | 65 | IOCIRecipe, | 64 | IOCIRecipe, |
11 | 66 | IOCIRecipeSet, | 65 | IOCIRecipeSet, |
12 | 67 | NoSuchOCIRecipe, | 66 | NoSuchOCIRecipe, |
13 | @@ -157,12 +156,7 @@ class OCIRecipeNavigationMenu(NavigationMenu): | |||
14 | 157 | 156 | ||
15 | 158 | @enabled_with_permission("launchpad.Edit") | 157 | @enabled_with_permission("launchpad.Edit") |
16 | 159 | def webhooks(self): | 158 | def webhooks(self): |
23 | 160 | return Link( | 159 | return Link("+webhooks", "Manage webhooks", icon="edit") |
18 | 161 | "+webhooks", | ||
19 | 162 | "Manage webhooks", | ||
20 | 163 | icon="edit", | ||
21 | 164 | enabled=bool(getFeatureFlag(OCI_RECIPE_WEBHOOKS_FEATURE_FLAG)), | ||
22 | 165 | ) | ||
24 | 166 | 160 | ||
25 | 167 | @enabled_with_permission("launchpad.Edit") | 161 | @enabled_with_permission("launchpad.Edit") |
26 | 168 | def delete(self): | 162 | def delete(self): |
27 | diff --git a/lib/lp/oci/interfaces/ocirecipe.py b/lib/lp/oci/interfaces/ocirecipe.py | |||
28 | index 516a0c3..0fbb391 100644 | |||
29 | --- a/lib/lp/oci/interfaces/ocirecipe.py | |||
30 | +++ b/lib/lp/oci/interfaces/ocirecipe.py | |||
31 | @@ -21,7 +21,6 @@ __all__ = [ | |||
32 | 21 | "OCIRecipePrivacyMismatch", | 21 | "OCIRecipePrivacyMismatch", |
33 | 22 | "OCI_RECIPE_ALLOW_CREATE", | 22 | "OCI_RECIPE_ALLOW_CREATE", |
34 | 23 | "OCI_RECIPE_BUILD_DISTRIBUTION", | 23 | "OCI_RECIPE_BUILD_DISTRIBUTION", |
35 | 24 | "OCI_RECIPE_WEBHOOKS_FEATURE_FLAG", | ||
36 | 25 | "UsingDistributionCredentials", | 24 | "UsingDistributionCredentials", |
37 | 26 | ] | 25 | ] |
38 | 27 | 26 | ||
39 | @@ -72,7 +71,6 @@ from lp.services.database.constants import DEFAULT | |||
40 | 72 | from lp.services.fields import PersonChoice, PublicPersonChoice | 71 | from lp.services.fields import PersonChoice, PublicPersonChoice |
41 | 73 | from lp.services.webhooks.interfaces import IWebhookTarget | 72 | from lp.services.webhooks.interfaces import IWebhookTarget |
42 | 74 | 73 | ||
43 | 75 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG = "oci.recipe.webhooks.enabled" | ||
44 | 76 | OCI_RECIPE_ALLOW_CREATE = "oci.recipe.create.enabled" | 74 | OCI_RECIPE_ALLOW_CREATE = "oci.recipe.create.enabled" |
45 | 77 | OCI_RECIPE_BUILD_DISTRIBUTION = "oci.default_build_distribution" | 75 | OCI_RECIPE_BUILD_DISTRIBUTION = "oci.default_build_distribution" |
46 | 78 | OCI_RECIPE_PRIVATE_FEATURE_FLAG = "oci.recipe.allow_private" | 76 | OCI_RECIPE_PRIVATE_FEATURE_FLAG = "oci.recipe.allow_private" |
47 | diff --git a/lib/lp/oci/subscribers/ocirecipebuild.py b/lib/lp/oci/subscribers/ocirecipebuild.py | |||
48 | index abdc541..9ecc7cf 100644 | |||
49 | --- a/lib/lp/oci/subscribers/ocirecipebuild.py | |||
50 | +++ b/lib/lp/oci/subscribers/ocirecipebuild.py | |||
51 | @@ -6,10 +6,8 @@ | |||
52 | 6 | from zope.component import getUtility | 6 | from zope.component import getUtility |
53 | 7 | 7 | ||
54 | 8 | from lp.buildmaster.enums import BuildStatus | 8 | from lp.buildmaster.enums import BuildStatus |
55 | 9 | from lp.oci.interfaces.ocirecipe import OCI_RECIPE_WEBHOOKS_FEATURE_FLAG | ||
56 | 10 | from lp.oci.interfaces.ocirecipebuild import IOCIRecipeBuild | 9 | from lp.oci.interfaces.ocirecipebuild import IOCIRecipeBuild |
57 | 11 | from lp.oci.interfaces.ocirecipebuildjob import IOCIRegistryUploadJobSource | 10 | from lp.oci.interfaces.ocirecipebuildjob import IOCIRegistryUploadJobSource |
58 | 12 | from lp.services.features import getFeatureFlag | ||
59 | 13 | from lp.services.scripts import log | 11 | from lp.services.scripts import log |
60 | 14 | from lp.services.webapp.publisher import canonical_url | 12 | from lp.services.webapp.publisher import canonical_url |
61 | 15 | from lp.services.webhooks.interfaces import IWebhookSet | 13 | from lp.services.webhooks.interfaces import IWebhookSet |
62 | @@ -17,26 +15,25 @@ from lp.services.webhooks.payload import compose_webhook_payload | |||
63 | 17 | 15 | ||
64 | 18 | 16 | ||
65 | 19 | def _trigger_oci_recipe_build_webhook(build, action): | 17 | def _trigger_oci_recipe_build_webhook(build, action): |
85 | 20 | if getFeatureFlag(OCI_RECIPE_WEBHOOKS_FEATURE_FLAG): | 18 | payload = { |
86 | 21 | payload = { | 19 | "recipe_build": canonical_url(build, force_local_path=True), |
87 | 22 | "recipe_build": canonical_url(build, force_local_path=True), | 20 | "action": action, |
88 | 23 | "action": action, | 21 | } |
89 | 24 | } | 22 | payload.update( |
90 | 25 | payload.update( | 23 | compose_webhook_payload( |
91 | 26 | compose_webhook_payload( | 24 | IOCIRecipeBuild, |
92 | 27 | IOCIRecipeBuild, | 25 | build, |
93 | 28 | build, | 26 | [ |
94 | 29 | [ | 27 | "recipe", |
95 | 30 | "recipe", | 28 | "build_request", |
96 | 31 | "build_request", | 29 | "status", |
97 | 32 | "status", | 30 | "registry_upload_status", |
98 | 33 | "registry_upload_status", | 31 | ], |
80 | 34 | ], | ||
81 | 35 | ) | ||
82 | 36 | ) | ||
83 | 37 | getUtility(IWebhookSet).trigger( | ||
84 | 38 | build.recipe, "oci-recipe:build:0.1", payload | ||
99 | 39 | ) | 32 | ) |
100 | 33 | ) | ||
101 | 34 | getUtility(IWebhookSet).trigger( | ||
102 | 35 | build.recipe, "oci-recipe:build:0.1", payload | ||
103 | 36 | ) | ||
104 | 40 | 37 | ||
105 | 41 | 38 | ||
106 | 42 | def oci_recipe_build_created(build, event): | 39 | def oci_recipe_build_created(build, event): |
107 | diff --git a/lib/lp/oci/tests/test_ocirecipe.py b/lib/lp/oci/tests/test_ocirecipe.py | |||
108 | index bc212a2..1d2a7f4 100644 | |||
109 | --- a/lib/lp/oci/tests/test_ocirecipe.py | |||
110 | +++ b/lib/lp/oci/tests/test_ocirecipe.py | |||
111 | @@ -36,7 +36,6 @@ from lp.oci.interfaces.ocipushrule import ( | |||
112 | 36 | from lp.oci.interfaces.ocirecipe import ( | 36 | from lp.oci.interfaces.ocirecipe import ( |
113 | 37 | OCI_RECIPE_ALLOW_CREATE, | 37 | OCI_RECIPE_ALLOW_CREATE, |
114 | 38 | OCI_RECIPE_BUILD_DISTRIBUTION, | 38 | OCI_RECIPE_BUILD_DISTRIBUTION, |
115 | 39 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG, | ||
116 | 40 | CannotModifyOCIRecipeProcessor, | 39 | CannotModifyOCIRecipeProcessor, |
117 | 41 | DuplicateOCIRecipeName, | 40 | DuplicateOCIRecipeName, |
118 | 42 | IOCIRecipe, | 41 | IOCIRecipe, |
119 | @@ -275,12 +274,7 @@ class TestOCIRecipe(OCIConfigHelperMixin, TestCaseWithFactory): | |||
120 | 275 | def test_requestBuild_triggers_webhooks(self): | 274 | def test_requestBuild_triggers_webhooks(self): |
121 | 276 | # Requesting a build triggers webhooks. | 275 | # Requesting a build triggers webhooks. |
122 | 277 | logger = self.useFixture(FakeLogger()) | 276 | logger = self.useFixture(FakeLogger()) |
129 | 278 | with FeatureFixture( | 277 | with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}): |
124 | 279 | { | ||
125 | 280 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on", | ||
126 | 281 | OCI_RECIPE_ALLOW_CREATE: "on", | ||
127 | 282 | } | ||
128 | 283 | ): | ||
130 | 284 | recipe = self.factory.makeOCIRecipe() | 278 | recipe = self.factory.makeOCIRecipe() |
131 | 285 | das = self.factory.makeDistroArchSeries() | 279 | das = self.factory.makeDistroArchSeries() |
132 | 286 | hook = self.factory.makeWebhook( | 280 | hook = self.factory.makeWebhook( |
133 | @@ -404,14 +398,7 @@ class TestOCIRecipe(OCIConfigHelperMixin, TestCaseWithFactory): | |||
134 | 404 | def test_requestBuildsFromJob_triggers_webhooks(self): | 398 | def test_requestBuildsFromJob_triggers_webhooks(self): |
135 | 405 | # requestBuildsFromJob triggers webhooks, and the payload includes a | 399 | # requestBuildsFromJob triggers webhooks, and the payload includes a |
136 | 406 | # link to the build request. | 400 | # link to the build request. |
145 | 407 | self.useFixture( | 401 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"})) |
138 | 408 | FeatureFixture( | ||
139 | 409 | { | ||
140 | 410 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on", | ||
141 | 411 | OCI_RECIPE_ALLOW_CREATE: "on", | ||
142 | 412 | } | ||
143 | 413 | ) | ||
144 | 414 | ) | ||
146 | 415 | recipe = removeSecurityProxy( | 402 | recipe = removeSecurityProxy( |
147 | 416 | self.factory.makeOCIRecipe(require_virtualized=False) | 403 | self.factory.makeOCIRecipe(require_virtualized=False) |
148 | 417 | ) | 404 | ) |
149 | @@ -507,12 +494,7 @@ class TestOCIRecipe(OCIConfigHelperMixin, TestCaseWithFactory): | |||
150 | 507 | 494 | ||
151 | 508 | def test_related_webhooks_deleted(self): | 495 | def test_related_webhooks_deleted(self): |
152 | 509 | owner = self.factory.makePerson() | 496 | owner = self.factory.makePerson() |
159 | 510 | with FeatureFixture( | 497 | with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}): |
154 | 511 | { | ||
155 | 512 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on", | ||
156 | 513 | OCI_RECIPE_ALLOW_CREATE: "on", | ||
157 | 514 | } | ||
158 | 515 | ): | ||
160 | 516 | recipe = self.factory.makeOCIRecipe(registrant=owner, owner=owner) | 498 | recipe = self.factory.makeOCIRecipe(registrant=owner, owner=owner) |
161 | 517 | webhook = self.factory.makeWebhook(target=recipe) | 499 | webhook = self.factory.makeWebhook(target=recipe) |
162 | 518 | with person_logged_in(recipe.owner): | 500 | with person_logged_in(recipe.owner): |
163 | diff --git a/lib/lp/oci/tests/test_ocirecipebuild.py b/lib/lp/oci/tests/test_ocirecipebuild.py | |||
164 | index da54f9c..be8e24c 100644 | |||
165 | --- a/lib/lp/oci/tests/test_ocirecipebuild.py | |||
166 | +++ b/lib/lp/oci/tests/test_ocirecipebuild.py | |||
167 | @@ -28,10 +28,7 @@ from lp.buildmaster.enums import BuildStatus | |||
168 | 28 | from lp.buildmaster.interfaces.buildqueue import IBuildQueue | 28 | from lp.buildmaster.interfaces.buildqueue import IBuildQueue |
169 | 29 | from lp.buildmaster.interfaces.packagebuild import IPackageBuild | 29 | from lp.buildmaster.interfaces.packagebuild import IPackageBuild |
170 | 30 | from lp.buildmaster.interfaces.processor import IProcessorSet | 30 | from lp.buildmaster.interfaces.processor import IProcessorSet |
175 | 31 | from lp.oci.interfaces.ocirecipe import ( | 31 | from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE |
172 | 32 | OCI_RECIPE_ALLOW_CREATE, | ||
173 | 33 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG, | ||
174 | 34 | ) | ||
176 | 35 | from lp.oci.interfaces.ocirecipebuild import ( | 32 | from lp.oci.interfaces.ocirecipebuild import ( |
177 | 36 | CannotScheduleRegistryUpload, | 33 | CannotScheduleRegistryUpload, |
178 | 37 | IOCIFileSet, | 34 | IOCIFileSet, |
179 | @@ -300,8 +297,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory): | |||
180 | 300 | hook = self.factory.makeWebhook( | 297 | hook = self.factory.makeWebhook( |
181 | 301 | target=self.build.recipe, event_types=["oci-recipe:build:0.1"] | 298 | target=self.build.recipe, event_types=["oci-recipe:build:0.1"] |
182 | 302 | ) | 299 | ) |
185 | 303 | with FeatureFixture({OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on"}): | 300 | self.build.updateStatus(BuildStatus.FULLYBUILT) |
184 | 304 | self.build.updateStatus(BuildStatus.FULLYBUILT) | ||
186 | 305 | expected_payload = { | 301 | expected_payload = { |
187 | 306 | "recipe_build": Equals( | 302 | "recipe_build": Equals( |
188 | 307 | canonical_url(self.build, force_local_path=True) | 303 | canonical_url(self.build, force_local_path=True) |
189 | @@ -343,8 +339,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory): | |||
190 | 343 | hook = self.factory.makeWebhook( | 339 | hook = self.factory.makeWebhook( |
191 | 344 | target=self.build.recipe, event_types=["oci-recipe:build:0.1"] | 340 | target=self.build.recipe, event_types=["oci-recipe:build:0.1"] |
192 | 345 | ) | 341 | ) |
195 | 346 | with FeatureFixture({OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on"}): | 342 | self.build.updateStatus(BuildStatus.BUILDING) |
194 | 347 | self.build.updateStatus(BuildStatus.BUILDING) | ||
196 | 348 | expected_logs = [ | 343 | expected_logs = [ |
197 | 349 | ( | 344 | ( |
198 | 350 | hook, | 345 | hook, |
199 | @@ -627,8 +622,7 @@ class TestOCIRecipeBuild(OCIConfigHelperMixin, TestCaseWithFactory): | |||
200 | 627 | hook = self.factory.makeWebhook( | 622 | hook = self.factory.makeWebhook( |
201 | 628 | target=self.build.recipe, event_types=["oci-recipe:build:0.1"] | 623 | target=self.build.recipe, event_types=["oci-recipe:build:0.1"] |
202 | 629 | ) | 624 | ) |
205 | 630 | with FeatureFixture({OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on"}): | 625 | self.build.scheduleRegistryUpload() |
204 | 631 | self.build.scheduleRegistryUpload() | ||
206 | 632 | expected_payload = { | 626 | expected_payload = { |
207 | 633 | "recipe_build": Equals( | 627 | "recipe_build": Equals( |
208 | 634 | canonical_url(self.build, force_local_path=True) | 628 | canonical_url(self.build, force_local_path=True) |
209 | diff --git a/lib/lp/oci/tests/test_ocirecipebuildjob.py b/lib/lp/oci/tests/test_ocirecipebuildjob.py | |||
210 | index 9722ae4..a8a1778 100644 | |||
211 | --- a/lib/lp/oci/tests/test_ocirecipebuildjob.py | |||
212 | +++ b/lib/lp/oci/tests/test_ocirecipebuildjob.py | |||
213 | @@ -22,10 +22,7 @@ from zope.security.proxy import removeSecurityProxy | |||
214 | 22 | 22 | ||
215 | 23 | from lp.buildmaster.enums import BuildStatus | 23 | from lp.buildmaster.enums import BuildStatus |
216 | 24 | from lp.buildmaster.interfaces.processor import IProcessorSet | 24 | from lp.buildmaster.interfaces.processor import IProcessorSet |
221 | 25 | from lp.oci.interfaces.ocirecipe import ( | 25 | from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE |
218 | 26 | OCI_RECIPE_ALLOW_CREATE, | ||
219 | 27 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG, | ||
220 | 28 | ) | ||
222 | 29 | from lp.oci.interfaces.ocirecipebuildjob import ( | 26 | from lp.oci.interfaces.ocirecipebuildjob import ( |
223 | 30 | IOCIRecipeBuildJob, | 27 | IOCIRecipeBuildJob, |
224 | 31 | IOCIRegistryUploadJob, | 28 | IOCIRegistryUploadJob, |
225 | @@ -212,14 +209,7 @@ class TestOCIRegistryUploadJob( | |||
226 | 212 | 209 | ||
227 | 213 | def setUp(self): | 210 | def setUp(self): |
228 | 214 | super().setUp() | 211 | super().setUp() |
237 | 215 | self.useFixture( | 212 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"})) |
230 | 216 | FeatureFixture( | ||
231 | 217 | { | ||
232 | 218 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on", | ||
233 | 219 | OCI_RECIPE_ALLOW_CREATE: "on", | ||
234 | 220 | } | ||
235 | 221 | ) | ||
236 | 222 | ) | ||
238 | 223 | self.setUpStats() | 213 | self.setUpStats() |
239 | 224 | 214 | ||
240 | 225 | def makeOCIRecipeBuild(self, **kwargs): | 215 | def makeOCIRecipeBuild(self, **kwargs): |
241 | @@ -641,7 +631,6 @@ class TestOCIRegistryUploadJobViaCelery( | |||
242 | 641 | self.useFixture( | 631 | self.useFixture( |
243 | 642 | FeatureFixture( | 632 | FeatureFixture( |
244 | 643 | { | 633 | { |
245 | 644 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on", | ||
246 | 645 | OCI_RECIPE_ALLOW_CREATE: "on", | 634 | OCI_RECIPE_ALLOW_CREATE: "on", |
247 | 646 | "jobs.celery.enabled_classes": "OCIRegistryUploadJob", | 635 | "jobs.celery.enabled_classes": "OCIRegistryUploadJob", |
248 | 647 | } | 636 | } |
249 | diff --git a/lib/lp/services/webhooks/tests/test_browser.py b/lib/lp/services/webhooks/tests/test_browser.py | |||
250 | index fa282fc..65ba0c3 100644 | |||
251 | --- a/lib/lp/services/webhooks/tests/test_browser.py | |||
252 | +++ b/lib/lp/services/webhooks/tests/test_browser.py | |||
253 | @@ -14,10 +14,7 @@ from lp.charms.interfaces.charmrecipe import ( | |||
254 | 14 | CHARM_RECIPE_ALLOW_CREATE, | 14 | CHARM_RECIPE_ALLOW_CREATE, |
255 | 15 | CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG, | 15 | CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG, |
256 | 16 | ) | 16 | ) |
261 | 17 | from lp.oci.interfaces.ocirecipe import ( | 17 | from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE |
258 | 18 | OCI_RECIPE_ALLOW_CREATE, | ||
259 | 19 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG, | ||
260 | 20 | ) | ||
262 | 21 | from lp.services.features.testing import FeatureFixture | 18 | from lp.services.features.testing import FeatureFixture |
263 | 22 | from lp.services.webapp.interfaces import IPlacelessAuthUtility | 19 | from lp.services.webapp.interfaces import IPlacelessAuthUtility |
264 | 23 | from lp.services.webapp.publisher import canonical_url | 20 | from lp.services.webapp.publisher import canonical_url |
265 | @@ -142,14 +139,7 @@ class OCIRecipeTestHelpers: | |||
266 | 142 | super().setUp() | 139 | super().setUp() |
267 | 143 | 140 | ||
268 | 144 | def makeTarget(self): | 141 | def makeTarget(self): |
277 | 145 | self.useFixture( | 142 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"})) |
270 | 146 | FeatureFixture( | ||
271 | 147 | { | ||
272 | 148 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on", | ||
273 | 149 | OCI_RECIPE_ALLOW_CREATE: "on", | ||
274 | 150 | } | ||
275 | 151 | ) | ||
276 | 152 | ) | ||
278 | 153 | owner = self.factory.makePerson() | 143 | owner = self.factory.makePerson() |
279 | 154 | return self.factory.makeOCIRecipe(registrant=owner, owner=owner) | 144 | return self.factory.makeOCIRecipe(registrant=owner, owner=owner) |
280 | 155 | 145 | ||
281 | diff --git a/lib/lp/services/webhooks/tests/test_job.py b/lib/lp/services/webhooks/tests/test_job.py | |||
282 | index f7e5e71..d80b634 100644 | |||
283 | --- a/lib/lp/services/webhooks/tests/test_job.py | |||
284 | +++ b/lib/lp/services/webhooks/tests/test_job.py | |||
285 | @@ -37,10 +37,7 @@ from lp.charms.interfaces.charmrecipe import ( | |||
286 | 37 | CHARM_RECIPE_ALLOW_CREATE, | 37 | CHARM_RECIPE_ALLOW_CREATE, |
287 | 38 | CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG, | 38 | CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG, |
288 | 39 | ) | 39 | ) |
293 | 40 | from lp.oci.interfaces.ocirecipe import ( | 40 | from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE |
290 | 41 | OCI_RECIPE_ALLOW_CREATE, | ||
291 | 42 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG, | ||
292 | 43 | ) | ||
294 | 44 | from lp.services.database.interfaces import IStore | 41 | from lp.services.database.interfaces import IStore |
295 | 45 | from lp.services.features.testing import FeatureFixture | 42 | from lp.services.features.testing import FeatureFixture |
296 | 46 | from lp.services.job.interfaces.job import JobStatus | 43 | from lp.services.job.interfaces.job import JobStatus |
297 | @@ -417,12 +414,7 @@ class TestWebhookDeliveryJob(TestCaseWithFactory): | |||
298 | 417 | def test_oci_recipe__repr__(self): | 414 | def test_oci_recipe__repr__(self): |
299 | 418 | # `WebhookDeliveryJob` objects for OCI recipes have an informative | 415 | # `WebhookDeliveryJob` objects for OCI recipes have an informative |
300 | 419 | # __repr__. | 416 | # __repr__. |
307 | 420 | with FeatureFixture( | 417 | with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}): |
302 | 421 | { | ||
303 | 422 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on", | ||
304 | 423 | OCI_RECIPE_ALLOW_CREATE: "on", | ||
305 | 424 | } | ||
306 | 425 | ): | ||
308 | 426 | recipe = self.factory.makeOCIRecipe() | 418 | recipe = self.factory.makeOCIRecipe() |
309 | 427 | hook = self.factory.makeWebhook(target=recipe) | 419 | hook = self.factory.makeWebhook(target=recipe) |
310 | 428 | job = WebhookDeliveryJob.create(hook, "test", payload={"foo": "bar"}) | 420 | job = WebhookDeliveryJob.create(hook, "test", payload={"foo": "bar"}) |
311 | diff --git a/lib/lp/services/webhooks/tests/test_model.py b/lib/lp/services/webhooks/tests/test_model.py | |||
312 | index cfa0a35..85d2c40 100644 | |||
313 | --- a/lib/lp/services/webhooks/tests/test_model.py | |||
314 | +++ b/lib/lp/services/webhooks/tests/test_model.py | |||
315 | @@ -13,10 +13,7 @@ from lp.charms.interfaces.charmrecipe import ( | |||
316 | 13 | CHARM_RECIPE_ALLOW_CREATE, | 13 | CHARM_RECIPE_ALLOW_CREATE, |
317 | 14 | CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG, | 14 | CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG, |
318 | 15 | ) | 15 | ) |
323 | 16 | from lp.oci.interfaces.ocirecipe import ( | 16 | from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE |
320 | 17 | OCI_RECIPE_ALLOW_CREATE, | ||
321 | 18 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG, | ||
322 | 19 | ) | ||
324 | 20 | from lp.registry.enums import BranchSharingPolicy | 17 | from lp.registry.enums import BranchSharingPolicy |
325 | 21 | from lp.services.database.interfaces import IStore | 18 | from lp.services.database.interfaces import IStore |
326 | 22 | from lp.services.features.testing import FeatureFixture | 19 | from lp.services.features.testing import FeatureFixture |
327 | @@ -500,12 +497,7 @@ class TestWebhookSetOCIRecipe(TestWebhookSetBase, TestCaseWithFactory): | |||
328 | 500 | if owner is None: | 497 | if owner is None: |
329 | 501 | owner = self.factory.makePerson() | 498 | owner = self.factory.makePerson() |
330 | 502 | 499 | ||
337 | 503 | with FeatureFixture( | 500 | with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}): |
332 | 504 | { | ||
333 | 505 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on", | ||
334 | 506 | OCI_RECIPE_ALLOW_CREATE: "on", | ||
335 | 507 | } | ||
336 | 508 | ): | ||
338 | 509 | return self.factory.makeOCIRecipe( | 501 | return self.factory.makeOCIRecipe( |
339 | 510 | registrant=owner, owner=owner, **kwargs | 502 | registrant=owner, owner=owner, **kwargs |
340 | 511 | ) | 503 | ) |
341 | diff --git a/lib/lp/services/webhooks/tests/test_webservice.py b/lib/lp/services/webhooks/tests/test_webservice.py | |||
342 | index fed30a0..86d577a 100644 | |||
343 | --- a/lib/lp/services/webhooks/tests/test_webservice.py | |||
344 | +++ b/lib/lp/services/webhooks/tests/test_webservice.py | |||
345 | @@ -23,10 +23,7 @@ from lp.charms.interfaces.charmrecipe import ( | |||
346 | 23 | CHARM_RECIPE_ALLOW_CREATE, | 23 | CHARM_RECIPE_ALLOW_CREATE, |
347 | 24 | CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG, | 24 | CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG, |
348 | 25 | ) | 25 | ) |
353 | 26 | from lp.oci.interfaces.ocirecipe import ( | 26 | from lp.oci.interfaces.ocirecipe import OCI_RECIPE_ALLOW_CREATE |
350 | 27 | OCI_RECIPE_ALLOW_CREATE, | ||
351 | 28 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG, | ||
352 | 29 | ) | ||
354 | 30 | from lp.services.features.testing import FeatureFixture | 27 | from lp.services.features.testing import FeatureFixture |
355 | 31 | from lp.services.webapp.interfaces import OAuthPermission | 28 | from lp.services.webapp.interfaces import OAuthPermission |
356 | 32 | from lp.soyuz.interfaces.livefs import ( | 29 | from lp.soyuz.interfaces.livefs import ( |
357 | @@ -498,12 +495,7 @@ class TestWebhookTargetOCIRecipe(TestWebhookTargetBase, TestCaseWithFactory): | |||
358 | 498 | 495 | ||
359 | 499 | def makeTarget(self): | 496 | def makeTarget(self): |
360 | 500 | owner = self.factory.makePerson() | 497 | owner = self.factory.makePerson() |
367 | 501 | with FeatureFixture( | 498 | with FeatureFixture({OCI_RECIPE_ALLOW_CREATE: "on"}): |
362 | 502 | { | ||
363 | 503 | OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on", | ||
364 | 504 | OCI_RECIPE_ALLOW_CREATE: "on", | ||
365 | 505 | } | ||
366 | 506 | ): | ||
368 | 507 | return self.factory.makeOCIRecipe(registrant=owner, owner=owner) | 499 | return self.factory.makeOCIRecipe(registrant=owner, owner=owner) |
369 | 508 | 500 | ||
370 | 509 | 501 |