Permalink
Browse files

The "Offer Talk" form now displays

  • Loading branch information...
1 parent d5ed558 commit d5cec7639ad7a39da9e3e22a8488349526bbb25b James Polley committed May 29, 2012
Showing with 35 additions and 10 deletions.
  1. +4 −1 doc/hitlist.rst
  2. +26 −0 usergroup/django_tests/talk_offer_test.py
  3. +5 −9 usergroup/offer_edit.py
View
@@ -162,14 +162,17 @@ Anonymous user clicks "offers a talk"
.. py:currentmodule:: usergroup.selenium_tests.talk_offer_test
-Done in func:`TestOffer.test_anonymous_user_clicks_offer_talk`
+Done in func:`TestAnonymousUserClicksOffer.test_anonymous_user_clicks_offer_talk`
Logged-in user offers a talk
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* Browse the main page as a logged-in user
* Click "Offer Talk"
* A second window opens with the "Offer Talk" form
+
+Done in func:`TestLoggedInUserClicksLogin.test_logged_in_user_clicks_offer_talk`
+
* Enter values into all fields
* Submit the form
* Verify that the window has redirected to "/offer/add#prevoffers"
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+"""Tests around creating, publishing, and announcing meetings.
+
+Does not use selenium, so cannot test client behaviour."""
+
+import datetime
+import random
+
+import django.test
+
+import usergroup.event_edit
+
+#TestCases have lots of public methods
+#pylint: disable=R0904
+
+class TestTalkOfferLogin(django.test.TestCase):
+ """Before we test anything else, let's see if login actually works"""
+ fixtures = ['test_admin_user', 'test_existing_user']
+
+ def test_offer_page(self):
+ """Ensure that the offer page loads."""
+ self.client.login(username='existing', password='password')
+ offer_page = self.client.get("/offer/add")
+ self.assertContains(offer_page, 'input name="consent"')
+
+
@@ -24,32 +24,28 @@
@auth.login_required
@method.require_http_methods(["GET", "POST"])
-def handler(request):
+def handler(request, key):
"""Handler for creating and editing Event objects."""
q = models.TalkOffer.objects.all()
- if not request.user.is_staff():
+ if not request.user.is_staff:
q = q.filter(created_by__exact=request.user)
offers = q[:100]
# /offer/<key> (POST/Get)
# /offer/add (POST/Get)
- try:
- unused_offer, key = request.path_info.split('/')
- except IndexError:
- return shortcuts.redirect('/offers')
if key == 'add':
- offer = models.Offer()
+ offer = models.TalkOffer()
else:
offer = shortcuts.get_object_or_404(models.TalkOffer, pk=key)
if request.method == 'GET':
offer_list = q[:100]
- return shortcut.render(
+ return shortcuts.render(request,
'offertalk.html', {
- 'offer': offer, 'offer_list': offers, 'self': self})
+ 'offer': offer, 'offer_list': offers})
elif request.method == 'POST':
return handler_edit(request, offer, offers)

0 comments on commit d5cec76

Please sign in to comment.