-
Notifications
You must be signed in to change notification settings - Fork 31
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 #93 from nrekretep/master
Add integration with Github Release Notifier
- Loading branch information
Showing
5 changed files
with
75 additions
and
0 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
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,9 @@ | ||
{ | ||
"date": [2017, 11, 13, 19, 46, 35, 0, 317, 0], | ||
"version": "0.7.2", | ||
"title": "Fixes split modules", | ||
"content": "", | ||
"media": "https://avatars0.githubusercontent.com/u/14236493?s=60&v=4", | ||
"author": "jaymoulin", | ||
"package_name": "jaymoulin/google-music-manager" | ||
} |
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,44 @@ | ||
"""Test module for Github Release Notifier (grn) formatter. | ||
ref https://github.com/femtopixel/github-release-notifier | ||
""" | ||
|
||
import unittest | ||
from pathlib import Path | ||
|
||
import httpx | ||
import nio | ||
|
||
from .start import BOT_URL, FULL_ID, KEY, MATRIX_ID, MATRIX_PW, MATRIX_URL | ||
|
||
|
||
class GithubReleaseNotifierFormatterTest(unittest.IsolatedAsyncioTestCase): | ||
"""GRN formatter test class.""" | ||
|
||
async def test_grn_body(self): | ||
"""Send a markdown message, and check the result.""" | ||
messages = [] | ||
client = nio.AsyncClient(MATRIX_URL, MATRIX_ID) | ||
|
||
await client.login(MATRIX_PW) | ||
room = await client.room_create() | ||
|
||
with Path("tests/example_grn.json").open() as f: | ||
example_grn_request = f.read() | ||
self.assertEqual( | ||
httpx.post( | ||
f"{BOT_URL}/{room.room_id}", | ||
params={"formatter": "grn", "key": KEY}, | ||
content=example_grn_request, | ||
).json(), | ||
{"status": 200, "ret": "OK"}, | ||
) | ||
|
||
sync = await client.sync() | ||
messages = await client.room_messages(room.room_id, sync.next_batch) | ||
await client.close() | ||
|
||
message = messages.chunk[0] | ||
self.assertEqual(message.sender, FULL_ID) | ||
self.assertIn("Fixes split modules", message.body) | ||
self.assertIn("jaymoulin/google-music-manager", message.body) |