Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (21 sloc) 1.459 kb
#-*- coding:utf-8 -*-
import unittest
from simple_db_migrate.core.exceptions import MigrationException
class MigrationExceptionTest(unittest.TestCase):
def test_it_should_use_default_message(self):
exception = MigrationException()
self.assertEqual('error executing migration', str(exception))
def test_it_should_use_custom_message(self):
exception = MigrationException('custom error message')
self.assertEqual('custom error message', str(exception))
def test_it_should_use_default_message_and_sql_command(self):
exception = MigrationException(sql='sql command executed')
self.assertEqual('error executing migration\n\n[ERROR DETAILS] SQL command was:\nsql command executed', str(exception))
def test_it_should_use_custom_message_and_sql_command(self):
exception = MigrationException(sql='sql command executed', msg='custom error message')
self.assertEqual('custom error message\n\n[ERROR DETAILS] SQL command was:\nsql command executed', str(exception))
def test_it_should_encode_error_message(self):
exception = MigrationException(sql=u'sql command executed with special chars çõá', msg=u'custom error message with special chars öá')
self.assertEqual('custom error message with special chars öá\n\n[ERROR DETAILS] SQL command was:\nsql command executed with special chars çõá', str(exception))
if __name__ == '__main__':
unittest.main()
Jump to Line
Something went wrong with that request. Please try again.