1. magik cypress
  2. django-minicms

Commits

magik_cypress  committed d1b33e0 Draft

add basic test

  • Participants
  • Parent commits dff13da
  • Branches default

Comments (0)

Files changed (4)

File README

View file
     $ python manage.py syncdb
     $ python manage.py runserver
 
+Production: (pythonanywhere.com)
+
+    $ export WORKON_HOME=~/minicms
+    $ mkdir -p $WORKON_HOME
+    $ source virtualenvwrapper.sh
+    $ mkvirtualenv django
+    $ hg clone https://bitbucket.org/magik_cypress/django-minicms
+    $ pip install -r django-minicms/requirement.txt --upgrade
+
+    $ wsgi.py (edit on pythonanywhere dashboard > web)
+    import os
+    import sys
+
+    # This activates the virtualenv for this script
+    activate_this = '/home/cyp/minicms/django/bin/activate_this.py'
+    execfile(activate_this, dict(__file__=activate_this))
+
+    import os
+    import sys
+
+    if '/home/cyp/minicmss' not in sys.path:
+        sys.path.insert(0, '/home/cyp/minicmss')
+
+    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
+
+    from django.core.wsgi import get_wsgi_application
+    application = get_wsgi_application()
+
 Requirements:
 
     - pep8
 ChangeLog:
 
 - fix article and comment after expire
+- add basic test
 
 --
 
 Todo:
 
 function _lookup_template can be optimized no ?
-
+WTF TZ and the naïve date
 
 Documentation:
 

File articles/tests.py

View file
 Replace this with more appropriate tests for your application.
 """
 
-from django.test import TestCase
-
-
-class SimpleTest(TestCase):
-    def test_basic_addition(self):
-        """
-        Tests that 1 + 1 always equals 2.
-        """
-        self.assertEqual(1 + 1, 2)
+from django.test import TestCase, Client

File minicms/settings.py

View file
 
 # Django settings for minicms project.
 from .version import __version__
-import os.path
+import os.path, sys
 
 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
     }
 }
 
+if 'test' in sys.argv:
+    DATABASES = {
+        'default': {
+            'ENGINE': 'django.db.backends.sqlite3',
+            'NAME':'/tmp/minicms.db',
+            'USER'       : '',
+            'PASSWORD' : '',
+            'HOST'     : '',
+        }
+    }
+
 # Local time zone for this installation. Choices can be found here:
 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
 # although not all choices may be available on all operating systems.
 USE_L10N = True
 
 # If you set this to False, Django will not use timezone-aware datetimes.
-USE_TZ = True
+USE_TZ = False
 
 PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
 PROJECT_NAME = os.path.basename(PROJECT_ROOT)

File rubriques/tests.py

View file
 Replace this with more appropriate tests for your application.
 """
 
-from django.test import TestCase
-from django.utils import unittest
-from .models import Rubrique
-
-
-class SimpleTest(TestCase):
-    def test_basic_addition(self):
-        """
-        Tests that 1 + 1 always equals 2.
-        """
-        self.assertEqual(1 + 1, 2)
-
-
-# class InsertTest(unittest.TestCase):
-#        def setUp(self):
-#            self.rubrique = Rubrique()
-
-#        def test_insert(self):
-#            timestamp = datetime.utcnow().replace(microsecond=0)
-#            rubrique = self.rubrique.objects.create(
-#               title='test article',
-#               title='test-article',
-#               content='Content lipsum hein!',
-#               published = True,
-#              publish_date = timestamp,
-#               expiry_date = timestamp + timedelta(7),
-#               comments_enabled = True,
-#               comments_expiry = 'week'
-#            self.assertEquals(self.rubrique, "test rubrique")
-
-
-class ResponseTest(unittest.TestCase):
-    def setUp(self):
-        self.rubrique = Rubrique()
-
-    def test_details(self):
-        response = self.rubrique.get('/rubriques/test-article/')
-        self.assertEqual(response.status_code, 200)
-        self.assertEqual(len(response.context['title']), 5)
+from django.test import TestCase, Client