def test_generate_metadata(self):
with RequestsMock() as rsp:
rsp.add(rsp.GET, re.compile('.*SHOW\+DATABASES.*'),
json=json_database_list, match_querystring=True)
rsp.add(rsp.GET, re.compile('.*SHOW\+MEASUREMENTS.*'),
json=json_measurement_list, match_querystring=True)
rsp.add(rsp.GET, re.compile('.*SHOW\+MEASUREMENTS.*'),
json=json_measurement_list, match_querystring=True)
rsp.add(rsp.GET, re.compile('.*SHOW\+FIELD\+KEYS.*'),
json=json_field_keys, match_querystring=True)
rsp.add(rsp.GET, re.compile('.*SHOW\+TAG\+KEYS.*'),
json=json_tag_keys, match_querystring=True)
rsp.add(rsp.GET, re.compile('.*SHOW\+FIELD\+KEYS.*'),
json=json_field_keys, match_querystring=True)
rsp.add(rsp.GET, re.compile('.*SHOW\+TAG\+KEYS.*'),
json=json_tag_keys, match_querystring=True)
rsp.add(rsp.GET, re.compile('.*SHOW\+FIELD\+KEYS.*'),
json=json_field_keys, match_querystring=True)
rsp.add(rsp.GET, re.compile('.*SHOW\+TAG\+KEYS.*'),
json=json_tag_keys, match_querystring=True)
rsp.add(rsp.GET, re.compile('.*SHOW\+FIELD\+KEYS.*'),
json=json_field_keys, match_querystring=True)
rsp.add(rsp.GET, re.compile('.*SHOW\+TAG\+KEYS.*'),
json=json_tag_keys, match_querystring=True)
metadata = generate_metadata('influxdb://localhost:8086')
file1 = open(os.path.join('test_data', 'test_metadata.xml'), 'r').read()
open(os.path.join('test_data', 'tmp_metadata.xml'), 'wb').write(metadata)
self.assert_(metadata == file1)
评论列表
文章目录