-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtests.py
More file actions
54 lines (41 loc) · 1.8 KB
/
tests.py
File metadata and controls
54 lines (41 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from unittest import TestCase
class TestPlugAndPlay(TestCase):
def setUp(self):
from plugandplay import save_delegate_share
save_delegate_share(1)
def tearDown(self):
from plugandplay import save_delegate_share
save_delegate_share(0)
def test_get_delegate_share(self):
from plugandplay import get_delegate_share
self.assertEqual(1, get_delegate_share())
def test_save_delegate_share(self):
from plugandplay import save_delegate_share, get_delegate_share
save_delegate_share(100)
self.assertEqual(100, get_delegate_share())
class TestUtils(TestCase):
def setUp(self):
import utils
utils.release_lock(strict=False)
def test_set_lock(self):
'''This test also makes sure a race condition isn't present.'''
import utils
utils.set_lock()
self.assertRaises(utils.LockError, utils.set_lock, strict=True)
def test_release_lock(self):
import utils
utils.release_lock(strict=False)
self.assertRaises(utils.LockError, utils.release_lock, strict=True)
class MiscTests(TestCase):
def test_last_payout_timestamp(self):
import arkdbtools.dbtools
import config
arkdbtools.dbtools.set_connection(
host=config.CONNECTION['HOST'],
database=config.CONNECTION['DATABASE'],
user=config.CONNECTION['USER'],
password=config.CONNECTION['PASSWORD'])
last_payout = arkdbtools.dbtools.Address.payout('AZHTEcD4sJnsTuano7RWD5R7hbYJcKGbrr')[-1].timestamp
true_last_payout_timestamp = 22552327
#this test will fail, update the true_last_payout_timestamp if you want to test it.
self.assertEqual(last_payout, true_last_payout_timestamp)