This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #180 from strongdm/feat/add-email-subaddress
Add email subaddressing
- Loading branch information
Showing
5 changed files
with
38 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ The following variables can be changed at runtime via slack -by an SDM_ADMIN- us | |
* **SDM_ENABLE_RESOURCES_FUZZY_MATCHING**. Tag to be used for enabling fuzzy matching for resources when a perfect match is not found. Default = true | ||
* **SDM_RESOURCE_GRANT_TIMEOUT_TAG**. Tag to be used for registering the time (in minutes) that a specific resource will be made available for the user. | ||
* **SDM_EMAIL_SLACK_FIELD**. Tag to be used for specifying a SDM email. For further information, please refer to [CONFIGURE_ALTERNATIVE_EMAILS.md](./CONFIGURE_ALTERNATIVE_EMAILS.md). | ||
* **SDM_EMAIL_SUBADDRESS**. Flag to be used for specifying a subaddress for the SDM email (e.g. "[email protected]" becomes "[email protected]" when SDM_EMAIL_SUBADDRESS equals to "sub"). Default = None | ||
|
||
See image below for more information: | ||
|
||
|
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 |
---|---|---|
|
@@ -387,6 +387,32 @@ def test_override_email(self, mocked_testbot): | |
assert "Granting" in granting_message | ||
assert self.override_email in granting_message | ||
|
||
class Test_email_subaddress: | ||
account_name_with_subaddress = '[email protected]' | ||
email_subaddress = 'stable' | ||
|
||
@pytest.fixture | ||
def mocked_testbot(self, testbot): | ||
config = create_config() | ||
config['SENDER_EMAIL_OVERRIDE'] = None | ||
config['SENDER_NICK_OVERRIDE'] = None | ||
config['EMAIL_SUBADDRESS'] = self.email_subaddress | ||
return inject_config(testbot, config, admins=[f'@{account_name}']) | ||
|
||
def test_email_subaddress(self, mocked_testbot): | ||
mocked_testbot._bot.callback_message = MagicMock(side_effect=callback_message_fn( | ||
mocked_testbot._bot, | ||
from_email=account_name, | ||
from_nick=account_name | ||
)) | ||
push_access_request(mocked_testbot) | ||
mocked_testbot.push_message(f"yes {access_request_id}") | ||
assert "valid request" in mocked_testbot.pop_message() | ||
assert "access request" in mocked_testbot.pop_message() | ||
granting_message = mocked_testbot.pop_message() | ||
assert "Granting" in granting_message | ||
assert self.account_name_with_subaddress in granting_message | ||
|
||
class Test_custom_resource_grant_timeout: | ||
timeout = 1 | ||
|
||
|
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