def setup(self): """ Set up the unit test suite. .. versionadded:: v00_03_00 """ self.connection = Connection(host='test_host', user='******', skey='test_skey')
class TestConnection(object): """ Nose unit test suite for Grenade Shotgun Connection wrapper. .. versionadded:: v00_03_00 """ def setup(self): """ Set up the unit test suite. .. versionadded:: v00_03_00 """ self.connection = Connection(host='test_host', user='******', skey='test_skey') def teardown(self): """ Tear down the unit test suite. .. versionadded:: v00_03_00 """ pass def test_init(self): """ Test that the Connection object is correctly initialised. .. versionadded:: v00_03_00 .. versionchanged:: 0.11.0 Update to use nose asserts statements. """ assert_equals(self.connection.host, 'test_host') assert_equals(self.connection.user, 'test_user') assert_equals(self.connection.skey, 'test_skey') assert_equals(self.connection.session, None) def test_connect(self): """ Test that connect() behaves as expected. .. versionadded:: v00_03_00 .. versionchanged:: 0.11.0 Update to use nose asserts statements. """ log = MockLog() try: session = self.connection.connect(log) assert_true(False) # we shouldn't ever get here except GrenadeConnectionError, e: assert_equals(len(log.messages['error']), 1) assert_true('Unable to connect' in log.messages['error'][0])