Beispiel #1
0
    def test_connect(self):
        mock_redshift = Mock()
        with patch.dict('sys.modules', psycopg2=mock_redshift):
            mock_redshift.connect.return_value = 'OK'

            redshift = RedshiftDatabase('test_host', 1234, 'test_database',
                                        'test_user', 'password')
            result = redshift.connect()

        self.assertEqual('OK', result)
        mock_redshift.connect.assert_called_once_with(
            host='test_host', port=1234, dbname='test_database',
            user='******', password='******',
        )
Beispiel #2
0
 def setUpClass(cls):
     super(TestRedshift, cls).setUpClass()
     cls.database = RedshiftDatabase()
Beispiel #3
0
 def setUpClass(cls):
     cls.database = RedshiftDatabase()