Answer principles round 1: 1 🔴, 7 🟡 (0 misread); every effect is handed in as an argument, no test patches a global, and the traces principle scopes tools that run on their user's machine
CI / tests (pull_request) Successful in 3m43s
CI / tests (pull_request) Successful in 3m43s
This commit is contained in:
@@ -2,7 +2,6 @@ import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
import unittest.mock
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
@@ -102,9 +101,9 @@ class Send(unittest.TestCase):
|
||||
|
||||
class HttpJson(unittest.TestCase):
|
||||
def test_sends_the_token_as_a_bearer_and_reads_mattermosts_message_from_an_error(self):
|
||||
with unittest.mock.patch.object(dm.json_request, "http_json", return_value={"id": "post-id"}) as sent:
|
||||
self.assertEqual(dm.http_json("POST", "https://chat.example/api/v4/posts", "secret-token", {"message": "hi"}), {"id": "post-id"})
|
||||
sent.assert_called_once_with("POST", "https://chat.example/api/v4/posts", "Bearer secret-token", {"message": "hi"}, dm.TIMEOUT, dm.error_message)
|
||||
sent = []
|
||||
self.assertEqual(dm.http_json("POST", "https://chat.example/api/v4/posts", "secret-token", {"message": "hi"}, lambda *request: sent.append(request) or {"id": "post-id"}), {"id": "post-id"})
|
||||
self.assertEqual(sent, [("POST", "https://chat.example/api/v4/posts", "Bearer secret-token", {"message": "hi"}, dm.TIMEOUT, dm.error_message)])
|
||||
self.assertEqual(dm.TIMEOUT, 10)
|
||||
|
||||
def test_reads_mattermosts_message_from_an_error_answer(self):
|
||||
|
||||
Reference in New Issue
Block a user