Пример #1
0
 def test_should_create_a_session_with_the_post_data(self):
     user = User.objects.create(username="******")
     data = {
         "title": "some title",
         "description": "some description",
         "type": "talk",
         "tags": "some, tags",
         "speakers": user.id,
     }
     request = RequestFactory().post("/", data)
     request.user = User()
     result = SubscribeView.as_view()(request)
     self.assertEqual(302, result.status_code)
     session = Session.objects.get(title=data["title"])
     self.assertTrue(session.id)
Пример #2
0
 def test_should_create_a_session_with_the_post_data(self):
     user = User.objects.create(username="******")
     data = {
         "title": "some title",
         "description": "some description",
         "type": "talk",
         "tags": "some, tags",
         "speakers": user.id,
     }
     request = RequestFactory().post("/", data)
     request.user = User()
     result = SubscribeView.as_view()(request)
     self.assertEqual(302, result.status_code)
     session = Session.objects.get(title=data["title"])
     self.assertTrue(session.id)
Пример #3
0
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url

from pythonbrasil8.dashboard.views import IndexView, ProfileView, SessionsView
from pythonbrasil8.subscription.views import SubscriptionView
from pythonbrasil8.schedule.views import DeleteSessionView, EditSessionView, SubscribeView


urlpatterns = patterns('',
    url(r'^$', IndexView.as_view(), name='dashboard-index'),
    url(r'^subscription/talk/$', SubscriptionView.as_view(), name='talk-subscription'),
    url(r'^profile/$', ProfileView.as_view(), name="edit-profile"),
    url(r'^proposals/$', SessionsView.as_view(), name="dashboard-sessions"),
    url(r'^proposals/propose/$', SubscribeView.as_view(), name='session-subscribe'),
    url(r'^proposals/edit/(?P<id>\d+)', EditSessionView.as_view(), name='session-edit'),
    url(r'^proposals/delete/(?P<id>\d+)', DeleteSessionView.as_view(), name='session-delete'),
)
Пример #4
0
 def test_should_be_form_in_context(self):
     result = SubscribeView.as_view()(self.request)
     self.assertIn('form', result.context_data)
     self.assertIsInstance(result.context_data['form'], SessionForm)
Пример #5
0
 def test_should_be_use_a_expected_template(self):
     result = SubscribeView.as_view()(self.request)
     self.assertEqual(['schedule/subscribe.html'], result.template_name)
Пример #6
0
 def test_should_returns_200_when_accessed_by_get(self):
     result = SubscribeView.as_view()(self.request)
     self.assertEqual(200, result.status_code)
Пример #7
0
 def test_should_be_form_in_context(self):
     result = SubscribeView.as_view()(self.request)
     self.assertIn('form', result.context_data)
     self.assertIsInstance(result.context_data['form'], SessionForm)
Пример #8
0
 def test_should_be_use_a_expected_template(self):
     result = SubscribeView.as_view()(self.request)
     self.assertEqual(['schedule/subscribe.html'], result.template_name)
Пример #9
0
 def test_should_returns_200_when_accessed_by_get(self):
     result = SubscribeView.as_view()(self.request)
     self.assertEqual(200, result.status_code)
Пример #10
0
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url

from pythonbrasil8.dashboard.views import IndexView, ProfileView
from pythonbrasil8.subscription.views import SubscriptionView
from pythonbrasil8.schedule.views import SubscribeView


urlpatterns = patterns('',
    url(r'^$', IndexView.as_view(), name='dashboard-index'),
    url(r'^subscribe/$', SubscribeView.as_view(), name='session-subscribe'),
    url(r'^subscription/talk/$', SubscriptionView.as_view(), name='talk-subscription'),
    url(r'^profile/$', ProfileView.as_view(), name="edit-profile")
)