Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

chore(client_test): adding in an old test from legacy PR#315 #752

Merged
merged 3 commits into from
Sep 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions influxdb/tests/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,49 @@ def test_create_retention_policy(self):
'"db" duration 1d replication 4 shard duration 0s'
)

def test_create_retention_policy_shard_duration(self):
"""Test create retention policy with a custom shard duration."""
example_response = '{"results":[{}]}'

with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/query",
text=example_response
)
self.cli.create_retention_policy(
'somename2', '1d', 4, database='db',
shard_duration='1h'
)

self.assertEqual(
m.last_request.qs['q'][0],
'create retention policy "somename2" on '
'"db" duration 1d replication 4 shard duration 1h'
)

def test_create_retention_policy_shard_duration_default(self):
"""Test create retention policy with a default shard duration."""
example_response = '{"results":[{}]}'

with requests_mock.Mocker() as m:
m.register_uri(
requests_mock.POST,
"http://localhost:8086/query",
text=example_response
)
self.cli.create_retention_policy(
'somename3', '1d', 4, database='db',
shard_duration='1h', default=True
)

self.assertEqual(
m.last_request.qs['q'][0],
'create retention policy "somename3" on '
'"db" duration 1d replication 4 shard duration 1h '
'default'
)

def test_alter_retention_policy(self):
"""Test alter retention policy for TestInfluxDBClient object."""
example_response = '{"results":[{}]}'
Expand Down