Onionr/onionr/tests/test_blocks.py

24 lines
829 B
Python
Raw Normal View History

#!/usr/bin/env python3
import sys, os
sys.path.append(".")
import unittest, uuid, hashlib
import nacl.exceptions
import nacl.signing, nacl.hash, nacl.encoding
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR)
os.environ["ONIONR_HOME"] = TEST_DIR
2019-07-25 16:14:13 +00:00
import onionrblocks
2019-09-10 22:35:44 +00:00
import onionrstorage
2019-07-25 16:14:13 +00:00
from utils import createdirs
2019-09-10 22:35:44 +00:00
from onionrutils import bytesconverter
2019-07-25 16:14:13 +00:00
createdirs.create_dirs()
class OnionrBlockTests(unittest.TestCase):
def test_plaintext_insert(self):
message = 'hello world'
2019-09-10 22:35:44 +00:00
bl = onionrblocks.insert(message)
self.assertIn(bytesconverter.str_to_bytes(message), onionrstorage.getData(bl))
#def test_encrypted_insert(self):
# key_pair_1 = nacl.signing.SigningKey.generate(encoder=nacl.encoding.base32)
unittest.main()