parent
							
								
									159c0e9ea0
								
							
						
					
					
						commit
						4a11359190
					
				| @ -0,0 +1,7 @@ | |||||||
|  | *.py[cod] | ||||||
|  | *.secret | ||||||
|  | *.vscode | ||||||
|  | 
 | ||||||
|  | test/* | ||||||
|  | .DS_Store | ||||||
|  | .directory | ||||||
| @ -0,0 +1,26 @@ | |||||||
|  | import uuid | ||||||
|  | 
 | ||||||
|  | class Manager(): | ||||||
|  |     # Manager class to manage a notiframe session.  | ||||||
|  |     def __init__(self): | ||||||
|  |         self.devices = {} | ||||||
|  |      | ||||||
|  |     def gen_id(self): | ||||||
|  |         return uuid.uuid4() | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | #do function wrapper here for tests functions, to say "test_function_name" success/failure | ||||||
|  | def TEST_manager(): | ||||||
|  |     manager = Manager() | ||||||
|  |     uuid_test = manager.gen_id() | ||||||
|  |     print(is_valid_uuid(uuid_test)) | ||||||
|  | 
 | ||||||
|  | # Test if manager class's gen_id function produces a valid uuid | ||||||
|  | def is_valid_uuid(val): | ||||||
|  |     try: | ||||||
|  |         uuid.UUID(str(val)) | ||||||
|  |         return True | ||||||
|  |     except ValueError: | ||||||
|  |         return False | ||||||
|  | 
 | ||||||
|  | TEST_manager() | ||||||
| @ -0,0 +1 @@ | |||||||
|  |   | ||||||
| @ -0,0 +1 @@ | |||||||
|  |   | ||||||
					Loading…
					
					
				
		Reference in new issue