-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove dependency to kinto-signer (#452)
* Remove obsolete events binding https://github.com/mozilla/remote-settings/blob/15776cebb18d3ae0fb633335417af89ceafff40f/kinto-remote-settings/src/kinto_remote_settings/signer/__init__.py#L264-L271 * Remove useless mentions of kinto-signer
- Loading branch information
Showing
3 changed files
with
4 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,7 +237,7 @@ def test_get_messages_can_filter_by_event_class(self): | |
"kinto-emailer": { | ||
"hooks": [ | ||
{ | ||
"event": "kinto_signer.events.ReviewRequested", | ||
"event": "mylib.MyEvent", | ||
"template": "Poll changed.", | ||
"recipients": ["[email protected]"], | ||
} | ||
|
@@ -248,7 +248,7 @@ def test_get_messages_can_filter_by_event_class(self): | |
messages = get_messages(self.storage, self.payload) | ||
assert len(messages) == 0 | ||
|
||
self.payload.update({"event": "kinto_signer.events.ReviewRequested"}) | ||
self.payload.update({"event": "mylib.MyEvent"}) | ||
messages = get_messages(self.storage, self.payload) | ||
assert len(messages) == 1 | ||
|
||
|
@@ -378,76 +378,6 @@ def test_context_contains_settings(self): | |
assert "{settings[project_name]}".format(**context) == "Kinto DEV" | ||
|
||
|
||
class SignerEventsTest(EmailerTest): | ||
@classmethod | ||
def get_app_settings(cls, extras=None): | ||
settings = super().get_app_settings(extras) | ||
settings["kinto.includes"] += " kinto_signer" | ||
settings["kinto.signer.resources"] = ( | ||
"/buckets/staging/collections/addons;" "/buckets/blocklists/collections/addons" | ||
) | ||
settings["kinto.signer.group_check_enabled"] = "false" | ||
settings["kinto.signer.to_review_enabled"] = "true" | ||
settings["kinto.signer.signer_backend"] = "kinto_signer.signer.autograph" | ||
settings["kinto.signer.autograph.server_url"] = "http://localhost:8000" | ||
settings["kinto.signer.autograph.hawk_id"] = "not-used-because-mocked" | ||
settings["kinto.signer.autograph.hawk_secret"] = "not-used-because-mocked" | ||
return settings | ||
|
||
def setUp(self): | ||
self._patch_autograph() | ||
collection = { | ||
"kinto-emailer": { | ||
"hooks": [ | ||
{ | ||
"event": "kinto_signer.events.ReviewRequested", | ||
"subject": "[{settings[project_name]}]", | ||
"template": "{user_id} requested review on {uri}.", | ||
"recipients": ["[email protected]"], | ||
} | ||
] | ||
} | ||
} | ||
self.headers = dict(self.headers, **get_user_headers("nous")) | ||
self.app.put("/buckets/staging", headers=self.headers) | ||
self.app.put_json( | ||
"/buckets/staging/collections/addons", {"data": collection}, headers=self.headers | ||
) | ||
self.app.post_json( | ||
"/buckets/staging/collections/addons/records", | ||
{"data": {"age": 42}}, | ||
headers=self.headers, | ||
) | ||
|
||
def _patch_autograph(self): | ||
# Patch calls to Autograph. | ||
patch = mock.patch("kinto_signer.signer.autograph.requests") | ||
self.addCleanup(patch.stop) | ||
mocked = patch.start() | ||
mocked.post.return_value.json.return_value = [ | ||
{ | ||
"ref": "", | ||
"signature": "", | ||
"hash_algorithm": "", | ||
"signature_encoding": "", | ||
"content-signature": "", | ||
"x5u": "", | ||
} | ||
] | ||
return patch | ||
|
||
def test_email_is_when_review_is_requested(self): | ||
with mock.patch("kinto_emailer.get_mailer") as get_mailer: | ||
self.app.patch_json( | ||
"/buckets/staging/collections/addons", | ||
{"data": {"status": "to-review"}}, | ||
headers=self.headers, | ||
) | ||
args, _ = get_mailer().send_immediately.call_args_list[0] | ||
message = args[0] | ||
assert message.subject == "[Emailer DEV]" | ||
|
||
|
||
class BatchRequestTest(EmailerTest): | ||
def setUp(self): | ||
bucket = { | ||
|