Skip to content

Commit

Permalink
Improved coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
puentesarrin committed May 21, 2014
1 parent b7aa99b commit eda96f0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions asyncflux/clusteradmins.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ def update(self, username, new_password):
def delete(self, username):
yield self.client._fetch('/cluster_admins/%(username)s',
{'username': username}, method='DELETE')

def __repr__(self):
return 'ClusterAdmins(%r)' % self.client
10 changes: 10 additions & 0 deletions tests/asyncflux_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,13 @@ class TestAsyncflux(unittest.TestCase):
def test_asyncflux_client_alias(self):
# Testing that asyncflux module imports client.AsyncfluxClient
c = asyncflux.AsyncfluxClient()

def test_version_string(self):
asyncflux.version_tuple = (0, 0, 0)
self.assertEqual(asyncflux.get_version_string(), '0.0.0')
asyncflux.version_tuple = (1, 0, 0)
self.assertEqual(asyncflux.get_version_string(), '1.0.0')
asyncflux.version_tuple = (5, 0, '+')
self.assertEqual(asyncflux.get_version_string(), '5.0+')
asyncflux.version_tuple = (0, 4, 'b')
self.assertEqual(asyncflux.get_version_string(), '0.4b')
9 changes: 9 additions & 0 deletions tests/clusteradmins_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from asyncflux import AsyncfluxClient
from asyncflux.clusteradmins import ClusterAdmins
from asyncflux.testing import AsyncfluxTestCase, gen_test
from asyncflux.util import InfluxException

Expand Down Expand Up @@ -146,3 +147,11 @@ def test_delete_fails_coro(self):
with self.assertRaisesRegexp(InfluxException,
"User me doesn't exists"):
yield self.cluster_admins.delete('me')

def test_repr(self):
host = 'localhost'
port = 8086
client = AsyncfluxClient(host, port)
self.assertEqual(repr(ClusterAdmins(client)),
("ClusterAdmins(AsyncfluxClient('%s', %d))" %
(host, port)))

0 comments on commit eda96f0

Please sign in to comment.