Esempio n. 1
0
    def test_post(self):
        subscription = Subscription.objects.create(
            user=self.user,
            type="talk",
        )
        transaction = Transaction.objects.create(subscription=subscription,
                                                 status="pending",
                                                 code="xpto",
                                                 price=123.45)
        notification_view = NotificationView()
        notification_view.transaction = (lambda code: (3, 1))
        request = RequestFactory().post("/", {"notificationCode": "123"})

        response = notification_view.post(request)

        transaction = Transaction.objects.get(id=transaction.id)
        self.assertEqual("done", transaction.status)
        self.assertEqual("OK", response.content)
Esempio n. 2
0
    def test_post(self):
        subscription = Subscription.objects.create(
            user=self.user,
            type="talk",
        )
        transaction = Transaction.objects.create(
            subscription=subscription,
            status="pending",
            code="xpto",
        )
        notification_view = NotificationView()
        notification_view.transaction = (lambda code: (3, 1))
        request = RequestFactory().post("/", {"notificationCode": "123"})

        response = notification_view.post(request)

        transaction = Transaction.objects.get(id=transaction.id)
        self.assertEqual("done", transaction.status)
        self.assertEqual("OK", response.content)
Esempio n. 3
0
 def test_transaction_canceled(self):
     subscription = Subscription.objects.create(
         user=self.user,
         type="talk",
     )
     transaction = Transaction.objects.create(subscription=subscription,
                                              status="pending",
                                              code="xpto",
                                              price="115.84")
     NotificationView().transaction_canceled(subscription.id)
     transaction = Transaction.objects.get(id=transaction.id)
     self.assertEqual("canceled", transaction.status)
Esempio n. 4
0
 def test_transaction_done(self):
     subscription = Subscription.objects.create(
         user=self.user,
         type="talk",
         status="pending",
     )
     transaction = Transaction.objects.create(subscription=subscription,
                                              status="pending",
                                              code="xpto",
                                              price="123.54")
     NotificationView().transaction_done(subscription.id)
     transaction = Transaction.objects.select_related("subscription").get(
         id=transaction.id)
     self.assertEqual("done", transaction.status)
     self.assertEqual("confirmed", transaction.subscription.status)
Esempio n. 5
0
    url(r'^news/$',
        TemplateView.as_view(template_name="news.html"),
        name='news'),
    url(r'^badges/$',
        TemplateView.as_view(template_name="badges.html"),
        name='badges'),
    url(r'^register/$',
        TemplateView.as_view(template_name="register.html"),
        name='register'),
    url(r'^sponsors/$', CustomSponsorsView.as_view(), name='custom-sponsors'),
    url(r'^schedule/$', ScheduleView.as_view(), name='schedule'),
    url(r'^sponsors/jobs/$', SponsorsJobsView.as_view(), name='sponsors-jobs'),
    url(r'about/$', AboutView.as_view(), name='about'),
    url(r'^venue/$', VenueView.as_view(), name='venue'),
    url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT}),
    url(r'^notification/$', NotificationView.as_view(), name='notification'),
    url(r'^dashboard/', include('pythonbrasil8.dashboard.urls')),
    url(r'^accounts/login/$',
        'django.contrib.auth.views.login',
        {'extra_context': {
            'registration_form': RegistrationForm()
        }},
        name='auth_login'),
    url(r'^accounts/logout/$',
        'django.contrib.auth.views.logout', {"next_page": "/"},
        name='auth_logout'),
    url(r'^accounts/', include('registration.backends.default.urls')),
    url(r'^admin/', include(admin.site.urls)),
)
Esempio n. 6
0
    url(r'^sponsors/jobs/$', SponsorsJobsView.as_view(), name='sponsors-jobs'),

    url(r'^schedule/$', 'pythonbrasil8.schedule.views.schedule', name='schedule'),
    url(r'^schedule/vote/?$', 'pythonbrasil8.schedule.views.vote_page',
        name='vote_page'),
    url(r'^schedule/(?P<track_slug>[^/]+)/?$',
        'pythonbrasil8.schedule.views.track_page', name='track-page'),
    url(r'^schedule/(?P<track_slug>[^/]+)/(?P<proposal_slug>.*)/?$',
        'pythonbrasil8.schedule.views.proposal_page', name='proposal-page'),

    url(r'about/$', AboutView.as_view(), name='about'),
    url(r'code-of-conduct/$', CodeOfConductView.as_view(), name='code-of-conduct'),
    url(r'^venue/$', VenueView.as_view(), name='venue'),
    url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),

    url(r'^notification/$', NotificationView.as_view(), name='notification'),

    url(r'^dashboard/', include('pythonbrasil8.dashboard.urls')),

    url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'extra_context': {'registration_form': RegistrationForm()}}, name='auth_login'),
    url(r'^accounts/logout/$', 'django.contrib.auth.views.logout', {"next_page": "/"}, name='auth_logout'),
    url(r'^accounts/password/reset/$', password_reset, {'email_template_name': 'email_password_reset.txt', 'subject_template_name': 'email_password_reset_title.txt', 'template_name': 'password_reset.html'}, name='password_reset'),
    url(r'^accounts/password/reset/done/$', TemplateView.as_view(template_name="password_reset_sent.html"), name='password_reset_sent'),
    url(r'^accounts/password/reset/confirm/(?P<uidb36>[0-9A-Za-z]{1,13})-(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', password_reset_confirm, {"template_name": "password_reset_confirm.html"}, name='password_reset_confirm'),
    url(r'^accounts/', include('registration.backends.default.urls')),
    url(r'^activities/', TemplateView.as_view(template_name="activities.html"), name='activities'),

    url(r'^news/', include('pythonbrasil8.news.urls', namespace='news')),
    url(r'^promo_code/', include('pythonbrasil8.promo_code.urls', namespace='promo_code')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^i18n/', include('django.conf.urls.i18n')),
Esempio n. 7
0
 def test_methods_by_status(self):
     methods_by_status = NotificationView().methods_by_status
     self.assertEqual("transaction_done", methods_by_status[3].__name__)
     self.assertEqual("transaction_canceled", methods_by_status[7].__name__)
Esempio n. 8
0
 def test_transaction_should_get_info_about_transaction(self):
     status, ref = NotificationView().transaction("code")
     self.assertEqual(3, status)
     self.assertEqual(3, ref)