Browse files

A little bit of tests and a docs

  • Loading branch information...
1 parent 3831e2d commit fc3bd8d9605d6c373ed322bf0dbe1d76e1055b88 @pydanny pydanny committed Jun 30, 2011
Showing with 101 additions and 0 deletions.
  1. +1 −0 docs/index.rst
  2. +78 −0 docs/settings.rst
  3. +1 −0 notification/tests/__init__.py
  4. +21 −0 notification/tests/test_models.py
View
1 docs/index.rst
@@ -23,6 +23,7 @@ Contents:
:maxdepth: 2
usage
+ settings
Indices and tables
==================
View
78 docs/settings.rst
@@ -0,0 +1,78 @@
+================================
+Notification specific Settings
+================================
+
+The following allows you to specify the behavior of django-notification in your
+project. Please be aware of the native Django settings which can affect the
+behavior of django-notification.
+
+
+NOTIFICATION_BACKENDS
+======================
+
+**Default**::
+
+ [
+ ("email", "notification.backends.email.EmailBackend"),`
+ ]
+
+TODO: Describe usage. Look at Pinax
+
+
+DEFAULT_HTTP_PROTOCOL
+======================
+
+**Default**: `http`
+
+This is used to specify the beginning of URLs in the default `email_body.txt`
+file. A common use-case for overriding this default might be `https` for use on
+more secure projects.
+
+NOTIFICATION_LANGUAGE_MODULE
+=============================
+
+**Default**: `Not defined`
+
+The default behavior for this setting is that it does not exist. It allows users to specify their own notification language.
+
+Example model in a `languages` app::
+
+ from django.conf import settings
+
+ class Language(models.Model):
+
+ user = models.ForeignKey(User)
+ language = models.CharField(_("language"), choices=settings.LANGUAGES, max_length="10")
+
+Setting this value in `settings.py`::
+
+ NOTIFICATION_LANGUAGE_MODULE = "languages.Language"
+
+DEFAULT_FROM_EMAIL
+==================
+
+**Default**: `webmaster@localhost`
+
+Docs: https://docs.djangoproject.com/en/1.3/ref/settings/#default-from-email
+
+Default e-mail address to use for various automated correspondence from
+notification.backends.email. Is actually part of Django core settings.
+
+LANGUAGES
+==========
+
+**Default**: `A tuple of all available languages.`
+
+Docs: https://docs.djangoproject.com/en/1.3/ref/settings/#languages
+
+The default for this is specifically used for things like the Django admin.
+However, if you need to specify a subset of languages for your site's front end
+you can use this setting to override the default. In which case this is the
+definated pattern of usage::
+
+ gettext = lambda s: s
+
+ LANGUAGES = (
+ ('en', gettext('English')),
+ ('fr', gettext('French')),
+ )
View
1 notification/tests/__init__.py
@@ -0,0 +1 @@
+from notification.tests.test_models import *
View
21 notification/tests/test_models.py
@@ -0,0 +1,21 @@
+from django.core.cache import cache
+from django.contrib.auth.models import User
+from django.test import TestCase
+
+from notification.models import NoticeType, NoticeSetting
+
+class BaseTest(TestCase):
+
+ def setUp(self):
+
+ self.user = User.objects.create_user('testuser','test@example.com','pw')
+ self.user.save()
+
+
+class TestNoticeType(BaseTest):
+
+ def test_create(self):
+
+ self.assertEquals(NoticeType.objects.count(), 0)
+ NoticeType.create("notice_type", "New notice type", "You have a new notice type")
+ self.assertEquals(NoticeType.objects.count(), 1)

0 comments on commit fc3bd8d

Please sign in to comment.