From 64125a78740e7958ce3fdabb636daf0ef752c3f7 Mon Sep 17 00:00:00 2001 From: shockrah Date: Sun, 21 Feb 2021 20:10:14 -0800 Subject: [PATCH] dumy test stats for no reason --- json-api/client-tests/client.py | 20 ++++++++++++++ json-api/endpoints.md | 49 --------------------------------- 2 files changed, 20 insertions(+), 49 deletions(-) delete mode 100644 json-api/endpoints.md diff --git a/json-api/client-tests/client.py b/json-api/client-tests/client.py index ef9e54f..c8f0ecb 100644 --- a/json-api/client-tests/client.py +++ b/json-api/client-tests/client.py @@ -74,6 +74,25 @@ class Worker: if self.body_logs[key] is True: print(f'\tBody: {self.responses[key].body}') + def test_stats(self): + passc = 0 + failc = 0 + total = len(self.responses) + + for key in self.responses: + hope = self.responses[key].expected + real = self.responses[key].code + if hope == real: + passc += 1 + else: + failc += 1 + + print('=======') + print(f'\033[1;32mPassing\033[0m {passc}/{total}') + print(f'\033[1;31mFailing\033[0m {failc}/{total}') + print('=======') + + def request(self, method: str, path: str, auth: str, opts: dict, expectation: int, show_body=False): assert(path[0] == '/') @@ -228,6 +247,7 @@ def run(worker: Worker): worker.request(method, path, auth, opts, hope) worker.logs() + worker.test_stats() if __name__ == '__main__': worker = Worker('http://localhost:4536', create_admin=True) diff --git a/json-api/endpoints.md b/json-api/endpoints.md deleted file mode 100644 index 58179b7..0000000 --- a/json-api/endpoints.md +++ /dev/null @@ -1,49 +0,0 @@ -# Documenting the currently tested / working endpoints - -Mostly a dev reference for now since it's a lot more terse. - -## Parameters - -All parameters are to be passed in via json, other parameters are ignored - -## Auth - -Basically every endpoint except for `/join` and `/meta` require the folowing auth -data at a bare minimum. - -* id: u64 -> User id [ Public to the instance ] - -* jwt: String - -To get a JWT you must `POST /login` with the following: - -* id: u64 -> User id [ Public to the instance ] - -* secret: String -> Server generated password - -## Chat api - -`/channels/list` NoPermsRequired - -No parameters required - -`/channels/create` RequiredPerm[CREATE_CHANNEL=64] - -* @Required name: `String` - -* @Required kind: `Signed 32-bit Integer` - -* @Optional description: `String` - -For voice channel `1`. For text channel `2`. All other options result in a HTTP 400. - - -`/channels/delete` RequiredPerm[DELETE_CHANNEL=128] - -* @Required channel_id: `Unsigned 64-bit Integer` - -`/message/send` RequiredPerm[SEND_MESSAGES=2] - -* @Required channel `Unsigned 64-bit Integer` - -* @Required content `String`