def test_write_influx(self, mocked_function): client = InfluxDB(name='something', config={'client': {}}) date = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f'") client.write(point=(date, 1)) mocked_function.assert_called_with( [{ "measurement": 'something', "tags": { "host": 'something-' + socket.gethostname(), }, "time": date, "fields": { "value": 1}}])
def test_write_parameters(self, mocked_function): client = InfluxDB(name='something', config={'client': {}}) date = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f'") client.write((date, 1)) mocked_function.assert_called_with((date, 1))
def test_init(self, mocked_class): client = InfluxDB(name='something', config={'client': {}}) assert mocked_class.called assert client.name == 'something'