Permalink
Browse files

many fixes

  • Loading branch information...
1 parent 80daa7f commit b3899d7c06a11a35a720ef7d7359d498e182e13b @andreysobol committed Mar 11, 2012
Showing with 18 additions and 14 deletions.
  1. +2 −0 testsobol/Makefile
  2. +1 −0 testsobol/mainapp/models.py
  3. +4 −4 testsobol/mainapp/tests.py
  4. +3 −2 testsobol/mainapp/views.py
  5. +6 −6 testsobol/settings.py
  6. +2 −2 testsobol/urls.py
View
@@ -0,0 +1,2 @@
+test:
+ python manage.py test mainapp
@@ -1,5 +1,6 @@
from django.db import models
+
class Bio(models.Model):
name = models.CharField(max_length=250)
surname = models.CharField(max_length=250)
@@ -12,12 +12,12 @@
class IndexViewTest(TestCase):
def test(self):
- fixtures = ['initial_data.json']
- bio = Bio.objects.get(pk = 1)
+ bio = Bio.objects.get(pk=1)
page = self.client.get('')
self.assertEqual(page.status_code, 200)
- lines = ('name','surname','birth','email','jabber','skype','bio','other',)
+ lines = ('name', 'surname', 'birth', 'email',
+ 'jabber', 'skype', 'bio', 'other',)
for line in lines:
- self.assertEqual(page.context[line],getattr(bio,line))
+ self.assertEqual(page.context[line], getattr(bio, line))
@@ -3,10 +3,11 @@
from models import Bio
+
class Index(TemplateView):
template_name = 'index.html'
def get_context_data(self, **kwargs):
- context = super(Index, self).get_context_data(**kwargs)
- return model_to_dict(Bio.objects.get(pk = 1))
+ super(Index, self).get_context_data(**kwargs)
+ return model_to_dict(Bio.objects.get(pk=1))
View
@@ -13,12 +13,12 @@
DATABASES = {
'default': {
- 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
- 'NAME': 'db.sqlite3', # Or path to database file if using sqlite3.
- 'USER': '', # Not used with sqlite3.
- 'PASSWORD': '', # Not used with sqlite3.
- 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
- 'PORT': '', # Set to empty string for default. Not used with sqlite3.
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': 'db.sqlite3',
+ 'USER': '',
+ 'PASSWORD': '',
+ 'HOST': '',
+ 'PORT': '',
}
}
View
@@ -1,4 +1,4 @@
-from django.conf.urls.defaults import patterns, include, url
+from django.conf.urls.defaults import patterns, url
from testsobol.mainapp.views import Index
# Uncomment the next two lines to enable the admin:
@@ -7,7 +7,7 @@
urlpatterns = patterns('',
# Examples:
- url(r'^$', Index.as_view())#, name='index'),
+ url(r'^$', Index.as_view()) # , name='index'),
# url(r'^testsobol/', include('testsobol.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:

0 comments on commit b3899d7

Please sign in to comment.