Coverage for tests/django_tests/db/bots/test_bot.py: 100%
24 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-12 13:49 +0000
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-12 13:49 +0000
1from typing import ClassVar
3from django_napse.core.models import Bot, Controller, EmptyStrategy
4from django_napse.utils.model_test_case import ModelTestCase
6"""
7python tests/test_app/manage.py test tests.django_tests.bots.test_bot -v2 --keepdb --parallel
8"""
11class BotDefaultTestCase:
12 model = Bot
13 strategy_class = EmptyStrategy
14 config_settings: ClassVar = {"empty": True}
16 @property
17 def architecture_constants(self):
18 return {
19 "controller": Controller.get(
20 exchange_account=self.exchange_account,
21 base="BTC",
22 quote="USDT",
23 interval="1d",
24 ),
25 }
27 def simple_create(self):
28 return self.model.objects.create(name="Test Bot", strategy=self.strategy)
30 @property
31 def config(self):
32 return self.strategy_class.config_class().objects.create(space=self.space, settings=self.config_settings)
34 @property
35 def architecture(self):
36 return self.strategy_class.architecture_class().objects.create(constants=self.architecture_constants)
38 @property
39 def strategy(self):
40 return self.strategy_class.objects.create(config=self.config, architecture=self.architecture)
43class BotBINANCETestCase(BotDefaultTestCase, ModelTestCase):
44 exchange = "BINANCE"