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,9 +2,10 @@
|
||||
import dataclasses
|
||||
import html
|
||||
import pathlib
|
||||
import typing
|
||||
|
||||
from failure import Failure
|
||||
from rest_client.json_request import Http
|
||||
from rest_client.json_request import Http, MessageOf
|
||||
from rest_client import json_request
|
||||
from rest_client.env_file import read_env
|
||||
|
||||
@@ -41,9 +42,10 @@ def send(config: Config, message: str, http: Http) -> Failure | None:
|
||||
return Failure(f"POST /api/chat.postMessage refused the message: {error if isinstance(error, str) and error else 'no error code'}")
|
||||
|
||||
|
||||
def http_json(method: str, url: str, token: str, body: object) -> object:
|
||||
# request is json_request.http_json, but in the test of what this hands it.
|
||||
def http_json(method: str, url: str, token: str, body: object, request: typing.Callable[[str, str, str, object, int, MessageOf], object] = json_request.http_json) -> object:
|
||||
"""The JSON that url answers to the bot's request, None where the answer has no body, or a Failure saying why there is none."""
|
||||
return json_request.http_json(method, url, f"Bearer {token}", body, TIMEOUT, error_message)
|
||||
return request(method, url, f"Bearer {token}", body, TIMEOUT, error_message)
|
||||
|
||||
|
||||
def error_message(answer: object) -> str:
|
||||
|
||||
Reference in New Issue
Block a user