Example #1
0
 def test_add_with_user(self):
     user = UserFactory()
     form = forms.AddYoutubeAccountForm(user, data={
         'add_button': '1',
     })
     assert_true(form.is_valid())
     # save doesn't do anything, but call it just to make sure it doesn't
     # throw an exception
     form.save()
     path = reverse('externalsites:youtube-add-account')
     assert_equal(form.redirect_path(),
                  '%s?username=%s' % (path, user.username))
Example #2
0
 def test_add_with_team(self):
     team = TeamFactory()
     form = forms.AddYoutubeAccountForm(team, data={
         'add_button': '1',
     })
     assert_true(form.is_valid())
     # save doesn't do anything, but call it just to make sure it doesn't
     # throw an exception
     form.save()
     path = reverse('externalsites:youtube-add-account')
     assert_equal(form.redirect_path(),
                  '%s?team_slug=%s' % (path, team.slug))
Example #3
0
 def test_no_add(self):
     team = TeamFactory()
     form = forms.AddYoutubeAccountForm(team, data={})
     assert_true(form.is_valid())
     assert_equal(form.redirect_path(), None)