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
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
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
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
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
def test_configuration(): configuration = Configuration() assert configuration.is_initialized() == False
def get(self): configuration = Configuration() if not self.store.has_configuration(): return configuration dictionary = self.store.get_configuration() return self._to_configuration(dictionary)