-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
42 additions
and
20 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 |
---|---|---|
|
@@ -23,7 +23,11 @@ class ProConnectMappingTest(aiounittest.AsyncTestCase): | |
#def setUp(self) -> None: | ||
|
||
async def test_with_map_should_replace(self): | ||
self.module = create_module({"user_id_lookup_fallback_rules":{"very-new.fr": "beta.fr", "new.fr": "beta.fr"}}) | ||
self.module = create_module({"user_id_lookup_fallback_rules": | ||
[ | ||
{"match":"very-new.fr", "search": "beta.fr"}, | ||
{ "match":"new.fr","search":"beta.fr"} | ||
]}) | ||
# Call the tested function with an email that requires replacement | ||
user_id = await self.module.search_user_id_by_threepid("[email protected]") | ||
# Assertions | ||
|
@@ -32,10 +36,14 @@ async def test_with_map_should_replace(self): | |
self.assertEqual(user_id, "test-beta") # Should match the replaced email | ||
|
||
|
||
async def test_replace_by_priority(self): | ||
self.module = create_module({"user_id_lookup_fallback_rules":{ | ||
"[email protected]":"[email protected]", | ||
"new.fr": "beta.fr"}})#replace by domain leads to a dead-end but it lower in the list | ||
async def test_replace_by_priority(self): | ||
self.module = create_module({"user_id_lookup_fallback_rules": | ||
[{"match":"[email protected]", "search": "[email protected]"}, | ||
{ "match":"new.fr","search":"beta.fr"} | ||
]}) | ||
|
||
|
||
#replace by domain leads to a dead-end but it lower in the list | ||
|
||
# Call the tested function with an email that requires replacement | ||
user_id = await self.module.search_user_id_by_threepid("[email protected]") | ||
|
@@ -45,8 +53,9 @@ async def test_replace_by_priority(self): | |
self.assertEqual(user_id, "test-old") # Should match the replaced email | ||
|
||
async def test_with_map_should_not_replace(self): | ||
self.module = create_module({"user_id_lookup_fallback_rules":{"new.fr": "beta.fr"}}) | ||
|
||
self.module = create_module({"user_id_lookup_fallback_rules": | ||
[{ "match":"new.fr","search":"beta.fr"}]}) | ||
|
||
# Call the tested function with an email that requires replacement | ||
user_id = await self.module.search_user_id_by_threepid("[email protected]") | ||
|
||
|
@@ -55,7 +64,7 @@ async def test_with_map_should_not_replace(self): | |
|
||
async def test_with_empty_map(self): | ||
|
||
self.module = create_module({"user_id_lookup_fallback_rules":{}}) | ||
self.module = create_module({"user_id_lookup_fallback_rules":[]}) | ||
|
||
# Call the tested function with an email that requires replacement | ||
user_id = await self.module.search_user_id_by_threepid("[email protected]") | ||
|