* Fixing busted invite test in api client tester
+ Adding some more invite status checks + Adding a verbose invite usage check for sanity reasons - Removing run-api-tests script as it now goes into the /scripts/ directory + Adding the wss-hmac setup from the command line arg It was literally just 1 if statement that I forgot to write in
This commit is contained in:
parent
2a1881db20
commit
34426038d9
@ -59,7 +59,6 @@ def req(admin: Admin, method: str, path: str, qs: dict, hope: int, headers: dict
|
||||
|
||||
def make_and_receive_invite(admin: Admin) -> (Request, Request):
|
||||
make_inv_req = req(admin, 'post', '/invite/create', {}, 200, verbose=True)
|
||||
user_inv_req = req(admin , 'get' , '/invite/join', new_invite_body, 200, verbose=True)
|
||||
|
||||
# Fire the first request and do some safety checks in case the request fails
|
||||
make_inv_req.fire()
|
||||
@ -67,7 +66,10 @@ def make_and_receive_invite(admin: Admin) -> (Request, Request):
|
||||
return (make_inv_req, user_inv_req)
|
||||
|
||||
# Setup to fire the second request, .fire() is safe to blindly use at this point
|
||||
print('Response text from /join ', make_inv_req.response.text)
|
||||
new_invite_body = make_inv_req.response.json()['invite']
|
||||
code = new_invite_body['id']
|
||||
user_inv_req = req(admin , 'get' , '/join', {'code': code}, 200, verbose=True)
|
||||
user_inv_req.fire()
|
||||
|
||||
return (make_inv_req, user_inv_req)
|
||||
@ -112,6 +114,7 @@ if __name__ == '__main__':
|
||||
req(admin, 'get', '/members/me', {}, 200),
|
||||
req(admin, 'get', '/members/get_online', {}, 200),
|
||||
req(admin, 'post', '/members/me/nickname', {'nick': f'randy-{time()}'}, 200),
|
||||
req(admin , 'get', '/invite/join', {'code': 123}, 404)
|
||||
])
|
||||
|
||||
# add this after fire the generic tests
|
||||
|
@ -38,7 +38,8 @@ class Request:
|
||||
self.response = requests.delete(self.url, headers=self.headers, params=self.qs)
|
||||
|
||||
return self.response
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return None
|
||||
|
||||
|
||||
|
@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# First the rtc server
|
||||
pushd ../rtc-server/
|
||||
node main.js&
|
||||
rtc_pid=$!
|
||||
popd
|
||||
|
||||
# Next the json api
|
||||
cargo run --release -- -s&
|
||||
json_pid=$!
|
||||
sleep 2
|
||||
|
||||
# Next come back and startup the rest test client
|
||||
source ./client-tests/bin/activate
|
||||
python3 client-tests/main.py
|
||||
|
||||
# catch errors that may occur and kill off process group
|
||||
trap "kill $json_pid $rtc_pid" exit INT TERM
|
||||
|
||||
# Normal exit (for the most part)
|
||||
kill -9 $json_pid $rtc_pid
|
||||
|
||||
echo Done
|
3
json-api/run-client.sh
Normal file
3
json-api/run-client.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
source ./client-tests/bin/activate
|
||||
python3 client-tests/main.py
|
@ -259,6 +259,9 @@ async fn main() -> Result<(), u16>{
|
||||
if let Some(hmac) = args.value_of("hmac") {
|
||||
std::env::set_var("HMAC_PATH", hmac);
|
||||
}
|
||||
if let Some(wss_hmac) = args.value_of("wss-hmac") {
|
||||
std::env::set_var("WSS_HMAC_PATH", wss_hmac);
|
||||
}
|
||||
|
||||
if args.is_present("server") {
|
||||
if main_ret == NO_ERR {
|
||||
|
Loading…
Reference in New Issue
Block a user