def test_url_get(self): with self.assertRaises(requests.ConnectionError): deviceconfig = DeviceConfig.download( "http://does/not/exist") # The post_key supplied here is not valid for anything, but we pass the "must have post_key test". deviceconfig = DeviceConfig.download( "https://friskby.herokuapp.com/sensor/api/device/FriskPITest/" , post_key = "xxx") deviceconfig.save( filename = self.config_file )
def test_url_get(self): with self.assertRaises(requests.ConnectionError): deviceconfig = DeviceConfig.download("http://does/not/exist") # The post_key supplied here is not valid for anything, but we pass the "must have post_key test". deviceconfig = DeviceConfig.download( "https://friskby.herokuapp.com/sensor/api/device/FriskPITest/", post_key="xxx") deviceconfig.save(filename=self.config_file)
def __init__(self): self.post_key = "6c918af4-7ab0-4812-a73e-80f7ed4f10f9" self.device_id = "FriskPITest" self.server_url = "https://friskby.herokuapp.com" self.post_path = "sensor/api/device/%s/" % self.device_id self.device_config = DeviceConfig.download( "%s/%s" % (self.server_url , self.post_path) , post_key = self.post_key) self.sensor_id = "FriskPITest_PM10" self.device_config_broken = DeviceConfig.download( "%s/%s" % (self.server_url , self.post_path) , post_key = self.post_key) self.device_config_broken.data["server_url"] = "http://invalid.no"
def test_url_get(self): with self.assertRaises(requests.ConnectionError): deviceconfig = DeviceConfig.download( "http://does/not/exist") deviceconfig = DeviceConfig.download( "https://friskby.herokuapp.com/sensor/api/device/FriskPI03/") deviceconfig.save( filename = self.config_file )
def test_client(self): # The post_key supplied here is not valid for anything, but we pass the "must have post_key test". device_config = DeviceConfig.download( "https://friskby.herokuapp.com/sensor/api/device/FriskPI03/", post_key="Key") client = FriskbyClient(device_config, "SensorID", "/tmp")
def test_client(self): device_config = DeviceConfig.download( "https://friskby.herokuapp.com/sensor/api/device/FriskPI03/") client = FriskbyClient(device_config, "SensorID")