Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
test internal checker
Browse files Browse the repository at this point in the history
  • Loading branch information
fou3fou3 committed Dec 29, 2023
1 parent b1b0d86 commit 47ae014
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"python.testing.unittestArgs": [
"-v",
"-s",
".",
"-p",
"test_*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true,
"python.analysis.typeCheckingMode": "off"
}
1 change: 0 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,4 @@ def start_price_cache():
app.run()

def get_app():
start_price_cache()
return app
19 changes: 17 additions & 2 deletions test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,23 @@ def test_views(self):
#test plot_response
plot_response = app_client.get(f'/backtest/{algorithm}?interval={interval}')
self.assertEqual(plot_response.status_code, 200)
time.sleep(5)
time.sleep(5) #Solved to many requests from kraken
time.sleep(2)

#Test internal checker authorization and results
authorization_data = {
'Authorization':
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXJ2ZXIiOiJzZXJ2ZXIiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjJ9.RuVgthZMSmoZQHuDVPioxWm6J8MjubpJXTbxamhAU44'
}
internal_checker_response = app_client.get('/internal_checker', headers=authorization_data)
self.assertEqual(internal_checker_response.status_code, 200)
for algorithm in utils.get_algorithms():
self.assertIn(algorithm, internal_checker_response.json['algorithms'])

#Check internal checker response to false
internal_checker_response = app_client.get('/internal_checker', headers={'not_correct': 'not_correct'})
self.assertEqual(internal_checker_response.status_code, 401)

time.sleep(2) #Solved to many requests from kraken

if __name__ == '__main__':
unittest.main()

0 comments on commit 47ae014

Please sign in to comment.