updating tests for members routes
This commit is contained in:
parent
c4db03f962
commit
34736bef3f
@ -21,11 +21,22 @@ full=
|
||||
testing() {
|
||||
release_opt=$1
|
||||
cargo build $release_opt
|
||||
# next we run the server in the background
|
||||
|
||||
cargo run $release_opt -- -s&
|
||||
sid=$!
|
||||
|
||||
# wait a sec
|
||||
echo Waiting on server to start
|
||||
sleep 3
|
||||
# now fire off client tests
|
||||
source ./client-tests/bin/activate
|
||||
python3 client-tests/client.py
|
||||
# if [ ! -z $full ];then
|
||||
# cargo test $release_opt
|
||||
# fi
|
||||
# clean up the server now
|
||||
kill -9 $sid
|
||||
if [ ! -z $full ];then
|
||||
cargo test $release_opt
|
||||
fi
|
||||
}
|
||||
|
||||
while getopts ":fhtTbr" arg; do
|
||||
|
@ -102,6 +102,7 @@ def run(worker: Worker):
|
||||
# Basically every test requires a jwt to be passed in so we grab that here
|
||||
# Should this fail so should nearly every other test from this point
|
||||
req_login = worker.request('post', '/login', 'basic',{}, 200)
|
||||
print(worker.responses[req_login].json())
|
||||
jwt = worker.responses[req_login].json()['jwt']
|
||||
|
||||
new_channel_name = time.time()
|
||||
@ -147,25 +148,25 @@ def run(worker: Worker):
|
||||
# can we get them back tho?
|
||||
{
|
||||
'init': [
|
||||
'get', '/message/get_range', {'channel_id': chan_d['id'], 'start-time': int(msg_chan_name-10), 'end-time': int(msg_chan_name + 10)}
|
||||
'get', '/message/get_range', {'channel_id': chan_d['id'], 'start_time': int(msg_chan_name-10), 'end_time': int(msg_chan_name + 10)}
|
||||
],
|
||||
'auth': jwt, 'hope': 200
|
||||
},
|
||||
{
|
||||
'init': [
|
||||
'get', '/message/get_range', {'channel_id': chan_d['id'], 'end-time': int(msg_chan_name)}
|
||||
'get', '/message/get_range', {'channel_id': chan_d['id'], 'end_time': int(msg_chan_name)}
|
||||
],
|
||||
'auth': jwt, 'hope': 400
|
||||
},
|
||||
{
|
||||
'init': [
|
||||
'get', '/message/get_range', {'channel_id': chan_d['id'], 'start-time': int(msg_chan_name), 'end-time': int(msg_chan_name)}
|
||||
'get', '/message/get_range', {'channel_id': chan_d['id'], 'start_time': int(msg_chan_name), 'end_time': int(msg_chan_name)}
|
||||
],
|
||||
'auth': jwt, 'hope': 400
|
||||
},
|
||||
{
|
||||
'init': [
|
||||
'get', '/message/get_range', {'channel_id': chan_d['id'], 'end-time': int(msg_chan_name), 'start-time': int(msg_chan_name)}
|
||||
'get', '/message/get_range', {'channel_id': chan_d['id'], 'end_time': int(msg_chan_name), 'start_time': int(msg_chan_name)}
|
||||
],
|
||||
'auth': jwt, 'hope': 400
|
||||
},
|
||||
@ -210,8 +211,23 @@ def run(worker: Worker):
|
||||
|
||||
|
||||
|
||||
member_tests = [
|
||||
{ 'init': ['get', '/members/me', {}], 'auth': jwt, 'hope': 200 },
|
||||
{ 'init': ['get', '/members/me', {'asdf': 123}], 'auth': jwt, 'hope': 200 },
|
||||
{ 'init': ['get', '/members/get_online', {}], 'auth': jwt, 'hope': 200, 'body': True},
|
||||
]
|
||||
|
||||
for test in member_tests:
|
||||
method, path, opts = test['init']
|
||||
auth = test['auth']
|
||||
hope = test['hope']
|
||||
if 'body' in test:
|
||||
worker.request(method, path, auth, opts, hope, show_body=test['body'])
|
||||
else:
|
||||
worker.request(method, path, auth, opts, hope)
|
||||
|
||||
worker.logs()
|
||||
|
||||
if __name__ == '__main__':
|
||||
worker = Worker('https://localhost', create_admin=True)
|
||||
worker = Worker('http://localhost:4536', create_admin=True)
|
||||
run(worker)
|
||||
|
@ -90,7 +90,7 @@ class Response:
|
||||
|
||||
# no color on the query like ever(because its typically massive
|
||||
if show_query:
|
||||
msg += f'\n\t{self.query_string[:80]}'
|
||||
msg += f'\n\t{self.query_string[:77]}...'
|
||||
|
||||
self.__write_msg(msg)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user