More tests that are passing <o/

This commit is contained in:
shockrah 2020-12-30 01:13:15 -08:00
parent dfe53b323e
commit 76fc2f66b3

View File

@ -142,6 +142,8 @@ class Test:
return self.body
def auth_tests(worker):
VOICE_CHAN = 1
TEXT_CHAN = 2
worker.stdout_to_stderr()
# the first two are sanity checks and should not faill
@ -153,43 +155,26 @@ def auth_tests(worker):
# now for some things that may/may not fail or something idk
cname = time.time()
# pass 200
newchannel = worker.post('/channels/create', jwt=jwt, name=f'{cname}', kind=1, description='some description')
newchannel = worker.post('/channels/create', jwt=jwt, name=f'{cname}', kind=2, description='some description')
newchannel = json.loads(newchannel)
# fail 400 or something
worker.post('/channels/create', jwt=jwt, name=f'{cname}', kind=1, description='some description')
worker.post('/channels/create', jwt=jwt, name=f'{cname}', kind=VOICE_CHAN, description='some description')
# ez pass
worker.get('/channels/list', jwt=jwt)
# pass 200
worker.post('/message/send', jwt=jwt, channel=newchannel['id'], content='some bullshit message')
# pass 200
worker.delete('/channels/delete', jwt=jwt, channel_id=newchannel['id'])
# these might be fucked now
def base_working_tests(worker):
# First the invites api gets some basic tests
# Channels things
VOICE_CHANNEL = 1
TEXT_CHANNEL = 2
new_channel_response = worker.post('/channels/create', name=f'{time.time()}', kind=TEXT_CHANNEL)
new_channel = json.loads(new_channel_response)
channel_list = json.loads(worker.get('/channels/list'))
worker.delete('/channels/delete', channel_id=new_channel['id'])
worker.get('/channels/list')
# Messaging
msg_chan_id = time.time()
msg_chan_raw = worker.post('/channels/create', name=f'{msg_chan_id}', kind=TEXT_CHANNEL)
msg_chan = json.loads(msg_chan_raw)
worker.post('/message/send', channel=msg_chan['id'], content="some random content")
worker.delete('/channels/delete', channel_id=msg_chan['id']) # finally clean up the channel we created
# fail 400
worker.post('/channels/create', jwt=False, name=f'succ', kind=2)
# fail
if __name__ == '__main__':
worker = Test(create_admin=False, init_verbose=True)
#base_working_tests(worker)
auth_tests(worker)