def setup(self):
     """
     Set up the unit test suite.
     
     .. versionadded:: 0.2.0
     """
     self.log = MockLog()
     self.message = 'test_message'
Exemplo n.º 2
0
    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])
Exemplo n.º 3
0
    def test_get_session(self):
        """
        Test that the Connection.get_session() method behaves correctly.
        
        .. versionadded:: v00_03_00
        .. versionchanged:: 0.11.0
            Update to use nose asserts statements.
        """
        log = MockLog()

        # should get None on an unconnected connection
        session = self.connection.get_session()
        assert_equals(session, None)

        # should also get None on an invalid connection
        try:
            self.connection.connect(log)
            assert_true(False)  # we shouldn't ever get here
        except GrenadeConnectionError, e:
            session = self.connection.get_session()
            assert_equals(session, None)