[Commits] python.it commit r274 - in code/pythonisti/trunk/pythonisti/apps: geo profile

commit a svn.python.it commit a svn.python.it
Lun 22 Gen 2007 17:49:09 CET


Author: rhymes
Date: Mon Jan 22 17:49:05 2007
New Revision: 274

Added:
   code/pythonisti/trunk/pythonisti/apps/geo/tests.py
   code/pythonisti/trunk/pythonisti/apps/profile/tests.py
Log:
add test stubs

Added: code/pythonisti/trunk/pythonisti/apps/geo/tests.py
==============================================================================
--- (empty file)
+++ code/pythonisti/trunk/pythonisti/apps/geo/tests.py	Mon Jan 22 17:49:05 2007
@@ -0,0 +1,11 @@
+import unittest
+from django.test.client import Client
+from pythonisti.apps.geo.models import *
+
+class TestGeoViews(unittest.TestCase):
+    def setUp(self):
+        self.client = Client()
+    
+    def testIndex(self):
+        response = self.client.get("/")
+        self.assertEqual(response.status_code, 200)

Added: code/pythonisti/trunk/pythonisti/apps/profile/tests.py
==============================================================================
--- (empty file)
+++ code/pythonisti/trunk/pythonisti/apps/profile/tests.py	Mon Jan 22 17:49:05 2007
@@ -0,0 +1,39 @@
+import unittest
+from django.contrib.auth.models import User
+from django.test import client
+from pythonisti.apps.profile.models import *
+
+place_data = dict(address="Via Rubattino 1", city="Chiari",
+    sub_administrative_area="Brescia", administrative_area="Lombardia",
+    postcode="12a45")
+    
+user_data = dict(username="prossi", password="xYz",
+    first_name="Paolo", last_name="Rossi")
+
+class SkillTestCase(unittest.TestCase):
+    def testCreation(self):
+        Skill.objects.create(name="django").delete()
+
+class PlaceTestCase(unittest.TestCase):
+    def testCreation(self):
+        italy = Country.objects.get(name__exact="ITALY")
+        place = Place(**place_data)
+        place.country = italy
+        place.save()
+        place.delete()
+
+class UserProfileTestCase(unittest.TestCase):
+    def testCreation(self):
+        user = User.objects.create(**user_data)
+        place = Place(**place_data)
+        place.country = Country.objects.get(name__exact="ITALY")
+        place.save()
+        profile = UserProfile()
+        profile.user = user
+        profile.place = place
+        # skill = Skill.objects.create(name="django")
+        # profile.skills.add(skill)
+        profile.company = "Ajax Inc."
+        profile.for_consultancy = True
+        profile.save()
+        profile.delete()


Maggiori informazioni sulla lista Commits