Skip to content

Commit

Permalink
create and publish the docuemntation pages
Browse files Browse the repository at this point in the history
See #31

@edwardtheharris - [email protected]

Xander Harris

Changelog: changed
  • Loading branch information
edwardtheharris committed Mar 13, 2024
1 parent 2d81890 commit c3185bc
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/tests/test_text.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/usr/bin/env python3
"""Tests for the Text class."""
# pylint: disable=E0401
"""Tests for the Text class.
import os
"""
import datetime
import json
import os
import pathlib

from unittest.mock import patch
from unittest.mock import Mock
Expand Down Expand Up @@ -53,7 +56,9 @@ def test_get_message(self):
test_message = text.get_message()

yml = YAML()
test_data = yml.load(open('tests/result/compliments.yml'))
cmp_yml = pathlib.Path('tests/result/compliments.yml')
with cmp_yml.open('r', encoding='utf-8') as cmp_fh:
test_data = yml.load(cmp_fh)
assert text.messages == test_data
assert isinstance(test_message, dict)
assert json.dumps(test_message)
Expand Down Expand Up @@ -115,13 +120,15 @@ def test_send_message(self, mocked_post):
message_dict = {
'phone': '2138765309',
'message': f'{text_text} - {text_from}',
'key': f'{test_key}_test',
'key': f'{test_key}_test ',
}
response_dict = json.load(open('tests/fixtures/resp.json'))
rsp = pathlib.Path('tests/fixtures/resp.json')
with rsp.open('r', encoding='utf-8') as rsp_fh:
response_dict = json.load(rsp_fh)
mocked_post.return_value = Mock(
status_code=200,
json=lambda: response_dict)
resp = requests.post(text.url, message_dict)
resp = requests.post(text.url, message_dict, timeout='60s')

assert resp.status_code == 200
assert isinstance(resp.json(), dict)
Expand All @@ -134,7 +141,9 @@ def test_write_messages(self):
text.write_messages()

yml = YAML()
test_data = yml.load(open('tests/compliments.yml'))
cmp_yml = pathlib.Path('tests/compliments.yml')
with cmp_yml.open('r', encoding='utf-8') as cmp_fh:
test_data = yml.load(cmp_fh)
assert text.messages == test_data

def test_message_rate(self):
Expand Down

0 comments on commit c3185bc

Please sign in to comment.