-Removed old tests altogether now its benchmarking time

This commit is contained in:
shockrah 2021-01-20 21:56:21 -08:00
parent d44ba36e58
commit aaa1378af8

View File

@ -84,15 +84,14 @@ class Worker:
# Build the request and store it in our structure # Build the request and store it in our structure
url = self.domain + path url = self.domain + path
req = Request(method, url, opts) req = http.Request(method, url, opts)
r_id = time.time() r_id = time.time()
self.requests[r_id] = req self.requests[r_id] = req
resp = req.make(expectation) resp = req.make(expectation)
self.responses[r_id] = resp self.responses[r_id] = resp
return req.id return r_id
def run(worker: Worker): def run(worker: Worker):
@ -116,61 +115,24 @@ def run(worker: Worker):
{'init': ['post', '/channels/list', {}], 'auth': jwt, 'hope': 200}, {'init': ['post', '/channels/list', {}], 'auth': jwt, 'hope': 200},
# somehow save this garbino # somehow save this garbino
{'init': ['post', '/channels/create', {name: str(new_channel_name), kind: 2, description: 'asdf'}], 'auth': jwt, 'hope': 200}, {'init': ['post', '/channels/create', {'name': str(new_channel_name), 'kind': 2, 'description': 'asdf'}], 'auth': jwt, 'hope': 200},
# Just a regular test no saving for this one # Just a regular test no saving for this one
{'init': ['post', '/channels/create', {name: str(new_channel_name+1), kind: 2,}], 'auth': jwt, 'hope': 200}, {'init': ['post', '/channels/create', {'name': str(new_channel_name+1), 'kind': 2,}], 'auth': jwt, 'hope': 200},
{'init': ['post', '/channels/create', {}], 'auth': jwt, 'hope': 400}, {'init': ['post', '/channels/create', {}], 'auth': jwt, 'hope': 400},
{'init': ['post', '/channels/create', {name: 123, kind: 'adsf'}], 'auth': jwt, 'hope': 400}, {'init': ['post', '/channels/create', {'name': 123, 'kind': 'adsf'}], 'auth': jwt, 'hope': 400},
# save this and compare its results to the previous # save this and compare its results to the previous
{'init': ['get', '/channels/list', {}], 'auth': jwt, 'hope': 200}, {'init': ['get', '/channels/list', {}], 'auth': jwt, 'hope': 200},
{'init': ['get', '/channels/list', {'random-param': 123}], 'auth': jwt, 'hope': 200}, {'init': ['get', '/channels/list', {'random-param': 123}], 'auth': jwt, 'hope': 200},
{'init': ['post'], 'auth': jwt, 'hope': 200}
] ]
for test in channel_tests: for test in channel_tests:
method = test['init'][0] method, path, opts = test['init']
path = test['init'][1] auth = test['auth']
opts = test['init'][2] hope = test['hope']
worker.request(method, path, test['auth'], opts, test['hope'])
# # 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'])
#
# # fail 400
# worker.post('/channels/create', jwt=False, name=f'succ', kind=2)
#
# # pass 200
# worker.get('/meta', jwt=jwt)
#
#
# # Getting messages now
# # pass 200
# send_chan = worker.post('/channels/create', jwt=jwt, name=f'{cname}', kind=2, description='some description')
# send_chan = json.loads(send_chan)
# # pass 200(all)
# spam_messages(send_chan['id'], jwt, worker)
# now = time.time()
# messages = json.loads(worker.get('/message/get_range', jwt=jwt, **{
# 'start-time': int(now - 15),
# 'end-time': int(now + 1),
# 'channel': send_chan['id']
# }))
#
# # 200 pass
# from_id = worker.get('/message/from_id', jwt=jwt, **{
# 'channel': send_chan['id'],
# 'start': messages['messages'][0]['id']
# })
# print('done')
worker.request(method, path, auth, opts, hope)
if __name__ == '__main__': if __name__ == '__main__':