mirror of
https://github.com/Hopiu/django.git
synced 2026-05-23 06:15:56 +00:00
Used assertRaisesMessage() to test MigrationLoader.get_migration_by_prefix()'s error messages.
This commit is contained in:
parent
7afca03c40
commit
52f9cfee9f
1 changed files with 4 additions and 2 deletions
|
|
@ -179,9 +179,11 @@ class LoaderTests(TestCase):
|
||||||
migration_loader.get_migration_by_prefix("migrations", "0001").name,
|
migration_loader.get_migration_by_prefix("migrations", "0001").name,
|
||||||
"0001_initial",
|
"0001_initial",
|
||||||
)
|
)
|
||||||
with self.assertRaises(AmbiguityError):
|
msg = "There is more than one migration for 'migrations' with the prefix '0'"
|
||||||
|
with self.assertRaisesMessage(AmbiguityError, msg):
|
||||||
migration_loader.get_migration_by_prefix("migrations", "0")
|
migration_loader.get_migration_by_prefix("migrations", "0")
|
||||||
with self.assertRaises(KeyError):
|
msg = "There no migrations for 'migrations' with the prefix 'blarg'"
|
||||||
|
with self.assertRaisesMessage(KeyError, msg):
|
||||||
migration_loader.get_migration_by_prefix("migrations", "blarg")
|
migration_loader.get_migration_by_prefix("migrations", "blarg")
|
||||||
|
|
||||||
def test_load_import_error(self):
|
def test_load_import_error(self):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue