Dodałem "django-nose" - runner testów dla nosetest.
authorŁukasz Rekucki <lrekucki@gmail.com>
Thu, 25 Feb 2010 22:30:22 +0000 (23:30 +0100)
committerŁukasz Rekucki <lrekucki@gmail.com>
Thu, 25 Feb 2010 22:30:22 +0000 (23:30 +0100)
Usunąłem "piston" z listy INSTALLED_APPS

.gitignore
apps/wiki/models.py
apps/wiki/tests.py
apps/wiki/views.py
platforma/settings.py
requirements.txt

index 9fa4e40..a73fc81 100644 (file)
@@ -14,4 +14,9 @@ thumbs.db
 
 # Netbeans garbage
 nbproject
-nbproject/*
\ No newline at end of file
+nbproject/*
+
+# Eclipse
+.project
+.pydevproject
+.settings
index 7b0f8ed..b4adba4 100644 (file)
@@ -3,18 +3,17 @@ import vstorage
 from vstorage import DocumentNotFound
 from wiki import settings
 
-
 class DocumentStorage(object):
     def __init__(self, path):
         self.vstorage = vstorage.VersionedStorage(path)
-    
-    def get(self, name, revision=None):
+
+    def get(self, name, revision = None):
         if revision is None:
             text = self.vstorage.page_text(name)
         else:
             text = self.vstorage.revision_text(name, revision)
-        return Document(self, name=name, text=text)
-    
+        return Document(self, name = name, text = text)
+
     def put(self, document, author, comment, parent):
         self.vstorage.save_text(document.name, document.text, author, comment, parent)
 
@@ -30,24 +29,24 @@ class DocumentStorage(object):
 
 class Document(object):
     META_REGEX = re.compile(r'\s*<!--\s(.*?)-->', re.DOTALL | re.MULTILINE)
-    
+
     def __init__(self, storage, **kwargs):
         self.storage = storage
         for attr, value in kwargs.iteritems():
             setattr(self, attr, value)
-            
+
     def revision(self):
         try:
             return self.storage._info(self.name)[0]
         except DocumentNotFound:
-            return -1
+            return - 1
 
     def plain_text(self):
         return re.sub(self.META_REGEX, '', self.text, 1)
-    
+
     def meta(self):
         result = {}
-        
+
         m = re.match(self.META_REGEX, self.text)
         if m:
             for line in m.group(1).split('\n'):
@@ -56,9 +55,8 @@ class Document(object):
                     result[k.strip()] = v.strip()
                 except ValueError:
                     continue
-        
-        return result
 
+        return result
 
+# Every time somebody says "let's have a global variable", God kills a kitten.
 storage = DocumentStorage(settings.REPOSITORY_PATH)
-
index e69de29..4262d20 100644 (file)
@@ -0,0 +1,12 @@
+import unittest
+import wiki.models as models
+
+class TestDocument(unittest.TestCase):
+
+    def setUp(self):
+        models.storage = None
+
+    def
+
+
+
index d64a529..f9e6996 100644 (file)
@@ -8,31 +8,30 @@ from django.utils import simplejson as json
 from wiki.models import storage, Document, DocumentNotFound
 from wiki.forms import DocumentForm
 
-
-def document_list(request, template_name='wiki/document_list.html'):
-    return direct_to_template(request, template_name, extra_context={
+def document_list(request, template_name = 'wiki/document_list.html'):
+    return direct_to_template(request, template_name, extra_context = {
         'document_list': storage.all(),
     })
 
 
-def document_detail(request, name, template_name='wiki/document_details.html'):
+def document_detail(request, name, template_name = 'wiki/document_details.html'):
     try:
         document = storage.get(name)
     except DocumentNotFound:
-        document = Document(storage, name=name, text='')
-    
+        document = Document(storage, name = name, text = '')
+
 
     if request.method == 'POST':
-        form = DocumentForm(request.POST, instance=document)
+        form = DocumentForm(request.POST, instance = document)
         if form.is_valid():
             document = form.save()
             return HttpResponse(json.dumps({'text': document.plain_text(), 'meta': document.meta(), 'revision': document.revision()}))
         else:
             return HttpResponse(json.dumps({'errors': form.errors}))
     else:
-        form = DocumentForm(instance=document)
-    
-    return direct_to_template(request, template_name, extra_context={
+        form = DocumentForm(instance = document)
+
+    return direct_to_template(request, template_name, extra_context = {
         'document': document,
         'form': form,
     })
index 11c2de3..6a1a12e 100755 (executable)
@@ -115,13 +115,16 @@ INSTALLED_APPS = (
     'django.contrib.admin',
     'django.contrib.admindocs',
 
+    'django_nose',
+
     'wiki',
-    'piston',
     'sorl.thumbnail',
     'filebrowser',
     'toolbar',
 )
 
+TEST_RUNNER = 'django_nose.run_tests'
+
 
 FILEBROWSER_URL_FILEBROWSER_MEDIA = STATIC_URL + 'filebrowser/'
 FILEBROWSER_DIRECTORY = 'images/'
index 56fe475..076171b 100644 (file)
@@ -1,9 +1,10 @@
 --find-links=http://stigma.nowoczesnapolska.org.pl/pypi/
 
 Django==1.1.1
-lxml==2.2.2
+lxml>=2.2,<2.3
 mercurial==1.3.1
 librarian>=1.3.dev,<1.4
 django-cas-consumer==0.1dev
 PyYAML>=3.0
 MySQL-python>=1.2,<2.0
+django-nose>=0.0.3