Commit 8e35e542 authored by Christophe Siraut's avatar Christophe Siraut

Tests continuation.

parent de1172bb
...@@ -4,5 +4,6 @@ ...@@ -4,5 +4,6 @@
fixtures fixtures
staticroot staticroot
local_settings.py local_settings.py
local_urls.py
.coverage .coverage
htmlcov htmlcov
...@@ -3,6 +3,7 @@ from django.contrib.sites.models import Site ...@@ -3,6 +3,7 @@ from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import datetime
import string import string
import random import random
...@@ -21,7 +22,7 @@ class Poll(models.Model): ...@@ -21,7 +22,7 @@ class Poll(models.Model):
max_length=8, max_length=8,
default=createId(5)) default=createId(5))
title = models.CharField(_('Title'), max_length=80) title = models.CharField(_('Title'), max_length=80)
pub_date = models.DateField(auto_now_add=True) pub_date = models.DateField(default=datetime.datetime.now)
upd_date = models.DateField(auto_now=True) upd_date = models.DateField(auto_now=True)
description = models.CharField(max_length=300) description = models.CharField(max_length=300)
user = models.ForeignKey(User, null=True) user = models.ForeignKey(User, null=True)
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</tr> </tr>
<tr> <tr>
<form action="/{{ object.id }}/vote/" method="post"> {% csrf_token %} <form action="." method="post"> {% csrf_token %}
<td class='names' title=" Fill in your name "> <td class='names' title=" Fill in your name ">
<div class="blue">{% trans "Your name:" %}</div> <div class="blue">{% trans "Your name:" %}</div>
{{ form.as_p }} {{ form.as_p }}
......
{% extends "base.html" %}
{% block title %}Create an meeting{% endblock %}
{% block content %}
<h3>Sondage: {{object}}</h3>
<p class="info">{{object.description}}</p>
<form method="post" action=""> {% csrf_token %}
<table id="dateChoice" class="form-container">
<tbody>
<thead>
<tr>
<th scope="col">Dates</th>
<th scope="col">Details</th>
</tr>
</thead>
{% for v in vforms.forms %}
<tr id="{{ v.prefix }}-row">
<td>
{% for fld in v.hidden_fields %}{{ fld }}{% endfor %}
{% if v.instance.pk %}{{ v.DELETE }}{% endif %}
{{ v.voter }}
</td>
<td>
{{ v.voice }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<p>
{{ vforms.management_form }}
<br /><label class="hide">.</label> <input type="submit" value="Save" />
</p>
</form>
</tbody>
</table>
{% endblock %}
...@@ -13,7 +13,7 @@ class LoginProcess(WebTest): ...@@ -13,7 +13,7 @@ class LoginProcess(WebTest):
login = self.app.get(reverse('auth_login')) login = self.app.get(reverse('auth_login'))
login.form['username'] = 'username_1' login.form['username'] = 'username_1'
login.form['password'] = 'password_1' login.form['password'] = 'password_1'
response = login.form.submit('Log in').follow() response = login.form.submit().follow()
self.assertEquals('200 OK', response.status) self.assertEquals('200 OK', response.status)
self.assertContains( self.assertContains(
response, 'My account', count=1, status_code=200) response, 'My account', count=1, status_code=200)
...@@ -22,7 +22,7 @@ class LoginProcess(WebTest): ...@@ -22,7 +22,7 @@ class LoginProcess(WebTest):
login = self.app.get(reverse('auth_login')) login = self.app.get(reverse('auth_login'))
login.form['username'] = 'foo' login.form['username'] = 'foo'
login.form['password'] = 'bar' login.form['password'] = 'bar'
response = login.form.submit('Log in') response = login.form.submit()
self.assertContains( self.assertContains(
response, response,
'Please enter a correct username and password.', 'Please enter a correct username and password.',
...@@ -53,3 +53,22 @@ class MeetingPoll(WebTest): ...@@ -53,3 +53,22 @@ class MeetingPoll(WebTest):
def test_404(self): def test_404(self):
response = self.app.get('/%s/' % createId(5), status=404) response = self.app.get('/%s/' % createId(5), status=404)
self.assertEqual(response.status_code, 404) self.assertEqual(response.status_code, 404)
def test_creation(self):
new = self.app.get(reverse('new'))
form = new.forms[0]
form['title'] = 'fake title'
form['description'] = 'fake description'
edition = form.submit().follow()
self.assertContains(
edition, 'Manage choices', count=1, status_code=200)
form = edition.forms[0]
form['choice_set-0-choice'] = '06-06-2013 17:00'
form['choice_set-0-details'] = 'fake detail'
votepage = form.submit().follow()
form = votepage.forms[0]
form['2013-06-06 17:00:00-voice'] = 1
form['2013-06-06 17:00:00-comment'] = "jaw-dropping comment"
votepageagain = form.submit()
self.assertContains(
votepageagain, 'jaw-dropping comment', count=1, status_code=200)
...@@ -17,3 +17,8 @@ urlpatterns = patterns('', ...@@ -17,3 +17,8 @@ urlpatterns = patterns('',
urlpatterns += i18n_patterns('', urlpatterns += i18n_patterns('',
url(r'^', include('nuages_base.urls_translated')), url(r'^', include('nuages_base.urls_translated')),
) )
try:
from local_urls import *
except ImportError, e:
pass
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
<div id="content"> <div id="content">
{% block content %}{% endblock %} {% block content %}{% endblock %}
{% block main %}{% endblock %}
</div> </div>
<div class="menu"> <div class="menu">
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
{% csrf_token %} {% csrf_token %}
{{ form.as_p }} {{ form.as_p }}
<input type="submit" value="{% trans 'Log in' %}" name="Log in" /> <input type="submit" value="{% trans 'Log in' %}" />
<input type="hidden" name="next" value="{{ next }}" /> <input type="hidden" name="next" value="{{ next }}" />
</form> </form>
<br /> <br />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment