Onionr/tests/default-plugin-tests/wot/test_get_identity_by_key.py

39 lines
911 B
Python
Raw Permalink Normal View History

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')
sys.path.append("src/")
import onionrblocks
from blockdb import block_db_path
from identity import Identity
from getbykey import get_identity_by_key
from identity.identityset import identities
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")
identities.add(identity)
self.assertIsInstance(get_identity_by_key(iden_public), Identity)
unittest.main()