2022-09-08 23:44:23 +00:00
|
|
|
import dbm
|
|
|
|
import os, uuid
|
|
|
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
TEST_DIR = 'testdata/%s-%s' % (str(uuid.uuid4())[:6], os.path.basename(__file__)) + '/'
|
|
|
|
print("Test directory:", TEST_DIR)
|
|
|
|
os.environ["ONIONR_HOME"] = TEST_DIR
|
|
|
|
os.makedirs(TEST_DIR)
|
|
|
|
|
|
|
|
from nacl import signing
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
import sys
|
2022-09-26 20:06:05 +00:00
|
|
|
sys.path.append('static-data/official-plugins/wot/wot')
|
2022-09-08 23:44:23 +00:00
|
|
|
sys.path.append("src/")
|
|
|
|
import onionrblocks
|
|
|
|
from blockdb import block_db_path
|
|
|
|
from identity import Identity
|
|
|
|
from getbykey import get_identity_by_key
|
2022-09-16 01:03:29 +00:00
|
|
|
from identity.identityset import identities
|
2022-09-08 23:44:23 +00:00
|
|
|
import blockdb
|
|
|
|
|
|
|
|
|
|
|
|
class GetIdentityByKeyTest(unittest.TestCase):
|
|
|
|
|
|
|
|
def test_get_identity_by_key(self):
|
|
|
|
iden_priv_key = signing.SigningKey.generate()
|
|
|
|
iden_public = iden_priv_key.verify_key
|
|
|
|
identity = Identity(iden_priv_key, "test")
|
|
|
|
|
2022-09-16 01:03:29 +00:00
|
|
|
identities.add(identity)
|
2022-09-08 23:44:23 +00:00
|
|
|
|
|
|
|
self.assertIsInstance(get_identity_by_key(iden_public), Identity)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unittest.main()
|