Skip to content

Commit 6baf7ee

Browse files
authored
chore(client_test): adding in an old test from legacy PR#315 (influxdata#752)
* chore(client_test): adding in an old test from legacy PR#315 * chore(client_test): update from GET to POST * chore(client_test): update to clear out flake8 issues
1 parent f3b3df5 commit 6baf7ee

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

influxdb/tests/client_test.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,49 @@ def test_create_retention_policy(self):
706706
'"db" duration 1d replication 4 shard duration 0s'
707707
)
708708

709+
def test_create_retention_policy_shard_duration(self):
710+
"""Test create retention policy with a custom shard duration."""
711+
example_response = '{"results":[{}]}'
712+
713+
with requests_mock.Mocker() as m:
714+
m.register_uri(
715+
requests_mock.POST,
716+
"http://localhost:8086/query",
717+
text=example_response
718+
)
719+
self.cli.create_retention_policy(
720+
'somename2', '1d', 4, database='db',
721+
shard_duration='1h'
722+
)
723+
724+
self.assertEqual(
725+
m.last_request.qs['q'][0],
726+
'create retention policy "somename2" on '
727+
'"db" duration 1d replication 4 shard duration 1h'
728+
)
729+
730+
def test_create_retention_policy_shard_duration_default(self):
731+
"""Test create retention policy with a default shard duration."""
732+
example_response = '{"results":[{}]}'
733+
734+
with requests_mock.Mocker() as m:
735+
m.register_uri(
736+
requests_mock.POST,
737+
"http://localhost:8086/query",
738+
text=example_response
739+
)
740+
self.cli.create_retention_policy(
741+
'somename3', '1d', 4, database='db',
742+
shard_duration='1h', default=True
743+
)
744+
745+
self.assertEqual(
746+
m.last_request.qs['q'][0],
747+
'create retention policy "somename3" on '
748+
'"db" duration 1d replication 4 shard duration 1h '
749+
'default'
750+
)
751+
709752
def test_alter_retention_policy(self):
710753
"""Test alter retention policy for TestInfluxDBClient object."""
711754
example_response = '{"results":[{}]}'

0 commit comments

Comments
 (0)