work on block insertion mixing

This commit is contained in:
Kevin Froman 2019-12-27 01:53:18 -06:00
parent 87ea8d137b
commit 01f9b9b470
12 changed files with 183 additions and 40 deletions

11
tests/test_template.py Normal file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env python3
import unittest, sys
sys.path.append(".")
sys.path.append("src/")
class TestTemplate(unittest.TestCase):
def test_my_test(self):
self.assertTrue(True)
unittest.main()

28
tests/test_timeinsert.py Normal file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env python3
import unittest, sys
sys.path.append(".")
sys.path.append("src/")
from onionrblocks import time_insert
from onionrblocks import onionrblockapi
class TestTimeInsert(unittest.TestCase):
def test_time_insert_none(self):
bl = time_insert('test')
self.assertTrue(bl)
bl = onionrblockapi.Block(bl)
self.assertIs(bl.bmetadata['dly'], 0)
def test_time_insert_10(self):
bl = time_insert('test', delay=10)
self.assertTrue(bl)
bl = onionrblockapi.Block(bl)
self.assertIs(bl.bmetadata['dly'], 10)
def test_negative(self):
self.assertRaises(ValueError, time_insert, 'test', delay=-1)
self.assertRaises(ValueError, time_insert, 'test', delay=-10)
unittest.main()