[damned-lies] Some test case cleaning



commit b402f1253097a73393693cd7c0ca082f24a3d96b
Author: Claude Paroz <claude 2xlibre net>
Date:   Wed Apr 14 00:37:52 2010 +0200

    Some test case cleaning

 people/views.py         |    5 +----
 stats/tests/__init__.py |    7 ++++---
 2 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/people/views.py b/people/views.py
index 2e90479..c809aa9 100644
--- a/people/views.py
+++ b/people/views.py
@@ -23,7 +23,7 @@ from django.http import HttpResponseRedirect
 from django.shortcuts import render_to_response, get_object_or_404
 from django.utils.translation import ugettext_lazy, ugettext as _, get_date_formats
 from django.template import RequestContext
-from django.db import transaction, IntegrityError
+from django.db import IntegrityError
 from django.contrib.auth.decorators import login_required
 from django.contrib.auth.forms import PasswordChangeForm
 from django.contrib.sites.models import Site
@@ -72,7 +72,6 @@ def person_detail_change(request):
             context_instance=RequestContext(request))
 
 @login_required
- transaction commit_manually
 def person_team_join(request):
     """Handle the form to join a team"""
     person = get_object_or_404(Person, username=request.user.username)
@@ -89,7 +88,6 @@ def person_team_join(request):
                                               message=ugettext_lazy("%(name)s has just joined your translation team on %(site)s"),
                                               messagekw = {'name': person.name, 'site': Site.objects.get_current()})
             except IntegrityError:
-                transaction.rollback()
                 request.user.message_set.create(message=_("You are already member of this team."))
     else:
         form = TeamJoinForm()
@@ -102,7 +100,6 @@ def person_team_join(request):
     }
 
     context_instance = RequestContext(request)
-    transaction.commit()
     return render_to_response('people/person_team_join_form.html', context,
             context_instance=context_instance)
 
diff --git a/stats/tests/__init__.py b/stats/tests/__init__.py
index fbbad58..d2d0717 100644
--- a/stats/tests/__init__.py
+++ b/stats/tests/__init__.py
@@ -19,6 +19,7 @@
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 import os, shutil
+from datetime import date
 from django.test import TestCase
 from django.test.client import Client
 from django.core import mail
@@ -73,7 +74,7 @@ class ModuleTestCase(TestCase):
         # Check stats
         self.b.update_stats(force=True)
         fr_po_stat = Statistics.objects.get(branch=self.b, domain__name='po', language__locale='fr')
-        self.assertEquals(fr_po_stat.translated, 40)
+        self.assertEquals(fr_po_stat.translated, 47)
         fr_doc_stat = Statistics.objects.get(branch=self.b, domain__name='help', language__locale='fr')
         self.assertEquals(fr_doc_stat.translated, 22)
 
@@ -150,7 +151,7 @@ class ModuleTestCase(TestCase):
         c = Client()
         response = c.get('/module/po/gnome-hello.po.master.ta.po')
         self.assertContains(response, """# Tamil translation for gnome-hello.
-# Copyright (C) 2009 gnome-hello's COPYRIGHT HOLDER
+# Copyright (C) %s gnome-hello's COPYRIGHT HOLDER
 # This file is distributed under the same license as the gnome-hello package.
-# FIRST AUTHOR <EMAIL ADDRESS>, YEAR.""")
+# FIRST AUTHOR <EMAIL ADDRESS>, YEAR.""" % date.today().year)
         self.assertContains(response, "Language-Team: Tamil <ta li org>")



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]