def test_fields(mock_flux): mock_res = mock.MagicMock() mock_res.get_points.return_value = [{"name": "fizz"}] mock_flux.return_value = mock_res db = influxdb.InfluxDBClient(database="fizz") client = InfluxAlchemy(db) assert client.fields(Measurement.new("foo")) == ["fizz"]
def test_fields(mock_flux): mock_res = mock.MagicMock() mock_res.get_points.return_value = [ {'fieldKey': 'humidity', 'fieldType': 'float'}, {'fieldKey': 'temperature', 'fieldType': 'float'} ] mock_flux.return_value = mock_res db = influxdb.InfluxDBClient(database="fizz") client = InfluxAlchemy(db) assert client.fields(Measurement.new("environment")) == ["humidity", "temperature"]
def test_fields(mock_flux): mock_res = mock.MagicMock() mock_res.get_points.return_value = [ {'fieldKey': 'humidity', 'fieldType': 'float'}, {'fieldKey': 'temperature', 'fieldType': 'float'} ] mock_flux.return_value = mock_res db = influxdb.InfluxDBClient(database="fizz") client = InfluxAlchemy(db) assert client.fields(Measurement.new("environment")) == ["humidity", "temperature"]