Example #1
0
def _initialize(resource):
    configuration = Configuration()
    configuration.initialize(resource.maker_id, resource.device_id,
                             resource.device_status,
                             resource.bluetooth_enabled, resource.aid,
                             resource.public_key, resource.private_key)
    return configuration
def test_configuration_initialize(resource):

    configuration = Configuration()
    configuration.initialize(resource.maker_id, resource.device_id,
                             resource.device_status,
                             resource.bluetooth_enabled, resource.aid,
                             resource.public_key, resource.private_key)
    assert configuration.is_initialized() == True
Example #3
0
 def _to_configuration(dictionary):
     configuration = Configuration()
     configuration.initialize(dictionary[MAKER_ID], dictionary[DEVICE_ID],
                              DeviceStatus[dictionary[DEVICE_STATUS]],
                              dictionary[ALTERNATIVE_ID],
                              dictionary[PUBLIC_KEY],
                              dictionary[PRIVATE_KEY])
     return configuration
Example #4
0
 def _to_configuration(dictionary):
     configuration = Configuration()
     configuration.initialize(
         dictionary[MAKER_ID],
         dictionary[DEVICE_ID],
         DeviceStatus[dictionary[DEVICE_STATUS]],
         # passing the dictionary of alternative value for initialization
         dictionary[ALTERNATIVE_ID],
         dictionary[PUBLIC_KEY],
         dictionary[PRIVATE_KEY])
     return configuration
Example #5
0
def test_get_headers(resource):
	
	configuration = Configuration()
	configuration.initialize(resource.maker_id, resource.device_id, resource.device_status,
					 resource.aid, resource.public_key, resource.private_key)

	header = {
		'Content-Type': 'application/json',
        'makerID': resource.maker_id,
        'deviceID': resource.device_id
	}

	assert configuration.get_headers() == header
Example #6
0
def test_get_device_information(resource):

	configuration = Configuration()
	configuration.initialize(resource.maker_id, resource.device_id, resource.device_status,
					 resource.aid, resource.public_key, resource.private_key)

	device_info = {
            'deviceID': resource.device_id,
            'makerID': resource.maker_id,
            'publicKey': resource.public_key,
			'multipair': 1,
            'aid': resource.aid
		}

	assert configuration.get_device_information() == device_info
Example #7
0
def test_configuration():
	configuration = Configuration()
	assert configuration.is_initialized() == False
Example #8
0
 def get(self):
     configuration = Configuration()
     if not self.store.has_configuration():
         return configuration
     dictionary = self.store.get_configuration()
     return self._to_configuration(dictionary)