def test_bulk(self):
        r = self.app.post('/input/bulk.json?site_id=1&apikey=YAYTESTS', data='[[121234123,9,16,1137],[2341234,11,17,1437]]', headers={'Content-Type': 'application/json'})

        assert 200 == r.status_code

        # Checking if data is mapped correctly and saved to influxs (power)
        power = list(api.influx.query('select value from power').get_points(measurement='power'))
        assert power[0]['value'] == 17
        assert power[1]['value'] == 16
        assert len(power), 2

        # Checking if the voltage data is mapped and saved correctly
        voltage = list(api.influx.query('select value from battery_voltage').get_points(measurement='battery_voltage'))
        assert voltage[0]['value'] == 1437
        assert voltage[1]['value'] == 1137
        assert len(voltage) == 2

        # Checking if the time is saved correctly to influx
        assert api.date_parser().parse(voltage[0]['time'].decode('utf-8')).year == 1970
    def test_bulk_compressed(self):
        data_compressed = zlib.compress('[[121234123,9,16,1137],[2341234,11,17,1437]]')
        headers = {'Content-Encoding': 'gzip', 'Content-Type': 'application/json'}
        api.app.config['BULK_MYSQL_INSERT'] = True

        r = self.app.post('/input/bulk.json?site_id=1&apikey=YAYTESTS',data=data_compressed, headers=headers)
        assert 200 == r.status_code
        

        # Checking if the data mapped and saved correctly
        power = list(api.influx.query('select value from power').get_points(measurement='power'))
        assert power[0]['value'] == 17
        assert power[1]['value'] == 16
        assert len(power) == 2

        # Checking if the voltage data is mapped and saved correctly
        voltage = list(api.influx.query('select value from battery_voltage').get_points(measurement='battery_voltage'))
        assert voltage[0]['value'] == 1437
        assert voltage[1]['value'] == 1137
        assert len(voltage) == 2

        # Check if the time is saved  correctly
        assert api.date_parser().parse(voltage[0]['time'].decode('utf-8')).year == 1970