Skip to content

Commit

Permalink
Merge pull request #9 from RockefellerArchiveCenter/development
Browse files Browse the repository at this point in the history
Migrate to Workflows
  • Loading branch information
helrond authored Sep 11, 2024
2 parents a4fa25e + 4aca9f1 commit 770b8e7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/handle_digitized_av_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def structure_teams_message(color_name, title, message, facts):
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.5",
"version": "1.4",
"body": [
{
"type": "TextBlock",
Expand All @@ -64,12 +64,17 @@ def structure_teams_message(color_name, title, message, facts):
}
]
}
return json.dumps(notification).encode('utf-8')
return json.dumps(notification)


def send_teams_message(message, url):
"""Delivers message to Teams channel endpoint."""
response = http.request('POST', url, body=message)
response = http.request(
'POST',
url,
headers={
'Content-Type': 'application/json'},
body=message)
logger.info('Status Code: {}'.format(response.status))
logger.info('Response: {}'.format(response.data))

Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/failure_message_out.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.5",
"version": "1.4",
"body": [
{
"type": "TextBlock",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/success_message_out.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.5",
"version": "1.4",
"body": [
{
"type": "TextBlock",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_handle_digitized_av_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_structure_teams_message():
with open(Path('tests', 'fixtures', fixture_path), 'r') as df:
expected = json.load(df)
output = structure_teams_message(*args)
assert output == json.dumps(expected).encode('utf-8')
assert output == json.dumps(expected)


@mock_ssm
Expand Down

0 comments on commit 770b8e7

Please sign in to comment.