Permalink
Browse files

Added tests for AttributeFilter

(Holy crap, this is the first test being added!)
  • Loading branch information...
1 parent 25f7d44 commit cfad026cf4dd8e30a817dadf8fc110ea8692c609 @chmarr committed Mar 18, 2013
Showing with 13 additions and 22 deletions.
  1. +0 −2 TODO
  2. +13 −20 artshow/tests.py
View
2 TODO
@@ -3,5 +3,3 @@
- Make bidder numbers more flexible, and allow entry of initial letters, and adjust mod11 check to suit
- use pdf gen to create invoices - keep text output version around.
- printing an invoice currently generates two messages
-- make sure the AttributeFilter in artshow.utils works as expected
-- PEP 8 entire project.
View
@@ -1,24 +1,17 @@
-"""
-This file demonstrates two different styles of tests (one doctest and one
-unittest). These will both pass when you run "manage.py test".
-
-Replace these with more appropriate tests for your application.
-"""
-
from django.test import TestCase
+from artshow.utils import artshow_settings
+from django.conf import settings
-class SimpleTest(TestCase):
- def test_basic_addition(self):
- """
- Tests that 1 + 1 always equals 2.
- """
- self.failUnlessEqual(1 + 1, 2)
-
-__test__ = {"doctest": """
-Another way to test that 1 + 1 is equal to 2.
-
->>> 1 + 1 == 2
-True
-"""}
+class AttributeFilterTest (TestCase):
+ def test_passed_access(self):
+ self.assertEqual(artshow_settings.SITE_NAME, settings.SITE_NAME)
+ self.assertEqual(artshow_settings.SITE_ROOT_URL, settings.SITE_ROOT_URL)
+ self.assertEqual(artshow_settings.ARTSHOW_SHOW_YEAR, settings.ARTSHOW_SHOW_YEAR)
+ def test_failed_access(self):
+ def get_secret_key():
+ return artshow_settings.SECRET_KEY
+ self.assertRaisesRegexp(AttributeError,
+ "AttributeFilter blocked access to 'SECRET_KEY'.*",
+ get_secret_key)

0 comments on commit cfad026

Please sign in to comment.