Esempio n. 1
0
    def test_clear_schema_unsupported(self):
        ''' Raise an exception if the database type is not supported. '''

        config = self.config_fixture(type='bogusdb')

        with self.assertRaises(ValueError):
            agnostic._clear_schema(config)
Esempio n. 2
0
    def test_clear_schema(self, connect_db_mock):
        ''' Run SQL commands to clear a schema. '''

        config = self.config_fixture()
        cursor = self.make_cursor(connect_db_mock)
        cursor.fetchall.return_value = [('dark_site',),('dark_user')]

        agnostic._clear_schema(config)

        self.assertTrue(connect_db_mock.called)
        self.assertTrue(cursor.execute.called)