-
Notifications
You must be signed in to change notification settings - Fork 82
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 #27 from rveachkc/develop
Version 0.1.9 - Python 2.7 support and http timeouts
- Loading branch information
Showing
11 changed files
with
163 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,4 +89,5 @@ ENV/ | |
.ropeproject | ||
*.pypirc | ||
|
||
rvtest.py | ||
rvtest.py | ||
.vscode/settings.json |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
atomicwrites==1.2.1 | ||
attrs==18.2.0 | ||
bleach==3.0.2 | ||
certifi==2018.4.16 | ||
chardet==3.0.4 | ||
colorama==0.4.1 | ||
docutils==0.14 | ||
idna==2.7 | ||
more-itertools==4.3.0 | ||
pkginfo==1.4.2 | ||
pluggy==0.8.0 | ||
py==1.7.0 | ||
Pygments==2.3.1 | ||
pytest==4.0.2 | ||
readme-renderer==24.0 | ||
requests==2.21.0 | ||
requests-toolbelt==0.8.0 | ||
six==1.12.0 | ||
tqdm==4.28.1 | ||
twine==1.12.1 | ||
urllib3==1.23 | ||
webencodings==0.5.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 was deleted.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,65 @@ | ||
import os | ||
import sys | ||
|
||
# add scripts to the path | ||
sys.path.append( | ||
os.path.split( | ||
os.path.dirname( | ||
os.path.abspath(__file__) | ||
) | ||
)[0] | ||
) | ||
import pymsteams | ||
|
||
def test_env_webhook_url(): | ||
""" | ||
Test that we have the webhook set as an environment variable. | ||
This is testing our test environment, not the code. | ||
""" | ||
webhook_url = os.getenv("MS_TEAMS_WEBHOOK", None) | ||
assert webhook_url | ||
assert webhook_url.find("https") == 0 | ||
|
||
def test_send_message(): | ||
""" | ||
This sends a simple text message with a title and link button. | ||
""" | ||
|
||
teams_message = pymsteams.connectorcard(os.getenv("MS_TEAMS_WEBHOOK")) | ||
teams_message.text("This is a simple text message.") | ||
teams_message.title("Simple Message Title") | ||
teams_message.addLinkButton("Go to the Repo", "https://github.com/rveachkc/pymsteams") | ||
teams_message.send() | ||
|
||
|
||
def test_send_sectioned_message(): | ||
""" | ||
This sends a message with sections. | ||
""" | ||
|
||
# start the message | ||
teams_message = pymsteams.connectorcard(os.getenv("MS_TEAMS_WEBHOOK")) | ||
teams_message.text("This is the main title.") | ||
teams_message.title("Sectioned Message Title") | ||
|
||
# section 1 | ||
section_1 = pymsteams.cardsection() | ||
section_1.title("Section 1 title") | ||
section_1.activityTitle("my activity title") | ||
section_1.activitySubtitle("my activity subtitle") | ||
section_1.activityImage("https://raw.githubusercontent.com/rveachkc/pymsteams/develop/test/desk_toys_1.jpg") | ||
section_1.activityText("This is my activity Text. You should see an activity image, activity title, activity subtitle, and this text (of course).") | ||
section_1.addFact("Fact", "this is fine") | ||
section_1.addFact("Fact", "this is also fine") | ||
section_1.text("This is my section 1 text. This section has an activity above and two facts below.") | ||
teams_message.addSection(section_1) | ||
|
||
# section 2 | ||
section_2 = pymsteams.cardsection() | ||
section_2.text("This is section 2. You should see an image. This section does not have facts or a title.") | ||
section_2.addImage("https://raw.githubusercontent.com/rveachkc/pymsteams/develop/test/desk_toys_2.jpg", ititle="Pew Pew Pew") | ||
teams_message.addSection(section_2) | ||
|
||
|
||
# send | ||
teams_message.send() |