Coverage for tests/django_tests/db/transactions/test_credit.py: 100%

17 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-03-12 13:49 +0000

1from django_napse.core.models import Credit 

2from django_napse.utils.model_test_case import ModelTestCase 

3 

4""" 

5python tests/test_app/manage.py test tests.django_tests.transactions.test_credit -v2 --keepdb --parallel 

6""" 

7 

8 

9class CreditTestCase: 

10 model = Credit 

11 

12 def simple_create(self): 

13 return Credit.objects.create( 

14 wallet=self.space.wallet, 

15 amount=1, 

16 ticker="BTC", 

17 ) 

18 

19 def test_empty_credit(self): 

20 credit = Credit.objects.create( 

21 wallet=self.space.wallet, 

22 amount=0, 

23 ticker="BTC", 

24 ) 

25 self.assertIsNone(credit) 

26 

27 def test_correct_amount(self): 

28 self.simple_create() 

29 self.assertEqual(self.space.wallet.get_amount("BTC"), 1) 

30 self.simple_create() 

31 self.assertEqual(self.space.wallet.get_amount("BTC"), 2) 

32 

33 

34class CreditBINANCETestCase(CreditTestCase, ModelTestCase): 

35 exchange = "BINANCE"