You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
831 B
32 lines
831 B
import uuid
|
|
|
|
class Manager():
|
|
# Manager class to manage a notiframe session.
|
|
def __init__(self):
|
|
self.devices = {}
|
|
|
|
def gen_id(self):
|
|
return uuid.uuid4()
|
|
|
|
class Test():
|
|
# Test class to test other classes and their functions.
|
|
def __init__(self):
|
|
#instantiate manager class
|
|
self.manager = Manager()
|
|
|
|
# Note: Do function wrapper here for tests functions, to say "test_function_name" success/failure
|
|
def manager_uuid(self):
|
|
uuid_test = self.manager.gen_id()
|
|
print(self.is_valid_uuid(uuid_test))
|
|
|
|
# Test if manager class's gen_id function produces a valid uuid
|
|
def is_valid_uuid(self, val):
|
|
try:
|
|
uuid.UUID(str(val))
|
|
return True
|
|
except ValueError:
|
|
return False
|
|
|
|
test = Test()
|
|
test.manager_uuid()
|