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

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fou3fou3 committed Mar 14, 2024
1 parent fc7cfb3 commit f688f54
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
9 changes: 3 additions & 6 deletions src/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
class TestApp(unittest.TestCase):

def test_app(self):
application = app.get_app()
application = app.app
app_client = application.test_client()
intervals = price.cached_intervals
intervals = price.supported_intervals
algorithms = utils.get_algorithms()
#Test backtest && backtest plot && plot views
for algorithm in algorithms:
Expand All @@ -30,7 +30,6 @@ def test_app(self):
#test plot_response
plot_response = app_client.get(f'/backtest/{algorithm}?interval={interval}')
self.assertEqual(plot_response.status_code, 200)
time.sleep(2)

#Test internal checker authorization and results
authorization_data = {
Expand All @@ -43,7 +42,5 @@ def test_app(self):
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'})
internal_checker_response = app_client.get('/signals', headers={'not_correct': 'not_correct'})
self.assertEqual(internal_checker_response.status_code, 401)

time.sleep(2) #Solved to many requests from kraken
2 changes: 1 addition & 1 deletion src/tests/test_backtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class TestApp(unittest.TestCase):
#Test backtest_module.py, using backtest plot data is because theres no much diffirence (optomization)
def test_backtest(self):
prices, timestamps = price.get_prices()
prices, timestamps = price.get_prices(240, 'USDC-WETH')
backtest_plot_data = backtest_module.backtest('bollinger_bands', prices, timestamps, plot=True)
#Test back test data keys are correct and backtest data exsits
backtest_dict = {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_price.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ def test_price(self):
#Test get default interval using 240 (change if the default interval is changed)
self.assertEqual(get_using_interval(), 240)
#Test get prices using is not none
self.assertIsNotNone(get_prices())
self.assertIsNotNone(get_prices(240, 'USDC-WETH'))

0 comments on commit f688f54

Please sign in to comment.