Skip to content

Instantly share code, notes, and snippets.

@nickpresta
Last active December 20, 2015 16:59
Show Gist options
  • Save nickpresta/6165605 to your computer and use it in GitHub Desktop.
Save nickpresta/6165605 to your computer and use it in GitHub Desktop.
## CALLING CODE
from django.conf import settings
def my_function():
foo = getattr(settings, 'foo', None)
if foo:
return foo.BAR
return BAZ
## TEST
def test_settings_dont_have_foo(self):
with self.settings(## UNSET FOO ##):
value = my_function()
self.assertEquals(value, BAZ)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment