Skip to content

Commit

Permalink
Added file forgotten in previous commit, plus one more test.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaugustin committed Dec 26, 2013
1 parent e179291 commit cfbdd58
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
27 changes: 27 additions & 0 deletions tests/apps/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from __future__ import unicode_literals

from django.apps import AppConfig


class MyAdmin(AppConfig):
name = 'django.contrib.admin'
verbose_name = "Admin sweet admin."


class MyAuth(AppConfig):
name = 'django.contrib.auth'
verbose_name = "All your password are belong to us."


class BadConfig(AppConfig):
"""This class doesn't supply the mandatory 'name' attribute."""


class NotAConfig(object):
name = 'apps'


class NoSuchApp(AppConfig):
name = 'there is no such app'


6 changes: 5 additions & 1 deletion tests/apps/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ def test_not_an_app_config(self):

def test_no_such_app(self):
"""
Tests when INSTALLED_APPS contains an app config for an app that doesn't exist.
Tests when INSTALLED_APPS contains an app that doesn't exist, either
directly or via an app config.
"""
with self.assertRaises(ImportError):
with self.settings(INSTALLED_APPS=['there is no such app']):
pass
with self.assertRaises(ImportError):
with self.settings(INSTALLED_APPS=['apps.apps.NoSuchApp']):
pass
Expand Down

0 comments on commit cfbdd58

Please sign in to comment.