Skip to content
This repository has been archived by the owner on Jul 12, 2020. It is now read-only.

Commit

Permalink
Tests: add test for init functions
Browse files Browse the repository at this point in the history
  • Loading branch information
eplaut committed Sep 1, 2016
1 parent e9da7fe commit 93c22c5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@


class ButlerTest(Butler):
def __init__(self, *args, **kwargs):
super(ButlerTest, self).__init__(*args, **kwargs)
self._is_server = False
self._is_client = False
self._check_args = args
self._check_kwargs = kwargs

def _init_server(self, *args, **kwargs):
super(ButlerTest, self)._init_server(*args, **kwargs)
self._is_server = True

def _init_client(self, *args, **kwargs):
super(ButlerTest, self)._init_client(*args, **kwargs)
self._is_client = True

def get_test_get(self):
return 'test get'

Expand Down
18 changes: 18 additions & 0 deletions tests/test_init_functions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from __future__ import absolute_import
from .fixtures import ButlerTest


def test_init_server():
butler_server = ButlerTest.Server('http://localhost:8888', 'a', 'b', 'c', x=1, y=2, z=3)
assert butler_server.butler._check_args == ('a', 'b', 'c')
assert butler_server.butler._check_kwargs == {'x': 1, 'y': 2, 'z': 3}
assert butler_server.butler._is_server is True
assert butler_server.butler._is_client is False


def test_init_client():
butler_client = ButlerTest.Client('http://localhost:8888', 'a', 'b', 'c', x=1, y=2, z=3)
assert butler_client.butler._check_args == ('a', 'b', 'c')
assert butler_client.butler._check_kwargs == {'x': 1, 'y': 2, 'z': 3}
assert butler_client.butler._is_server is False
assert butler_client.butler._is_client is True

0 comments on commit 93c22c5

Please sign in to comment.