-
Notifications
You must be signed in to change notification settings - Fork 171
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 #410 from chillipeper/html_link_converter_slack
Html link converter slack
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from will.backends.io_adapters import slack | ||
|
||
|
||
class TestSlackMarkdownConverter: | ||
converter = slack.SlackMarkdownConverter() | ||
|
||
def test_convert_strong_with_text(self): | ||
slack_strong = self.converter.convert_strong("<b>", "hello") | ||
assert slack_strong == "*hello*" | ||
|
||
def test_convert_strong_with_empty_text(self): | ||
slack_strong = self.converter.convert_strong("<b>", "") | ||
assert slack_strong == "" | ||
|
||
def test_convert_a_with_text(self): | ||
slack_a = self.converter.convert_a({"href": "https://www.google.com"}, | ||
"Google") | ||
assert slack_a == "<https://www.google.com|Google>" | ||
|
||
def test_convert_a_with_text_same_as_href(self): | ||
slack_a = self.converter.convert_a({"href": "https://www.google.com"}, | ||
"https://www.google.com") | ||
assert slack_a == "<https://www.google.com>" |