Пример #1
0
    def test_repeat_username(self):
        """Verify one cannot repeat email adresses."""
        register = dict(
                 username='******',
                 first_name='Akaaaaaaash',
                 last_name='Desaaaaaaai',
                 optin=True
        )

        # Create first user
        email1 = '*****@*****.**'
        register.update(email=email1)
        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid(email1):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        with browserid_mock.mock_browserid(email1):
            self.client.post(reverse('register'), register, follow=True)

        self.client.logout()
        # Create a different user
        email2 = '*****@*****.**'
        register.update(email=email2)
        with browserid_mock.mock_browserid(email2):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        with browserid_mock.mock_browserid(email2):
            r = self.client.post(reverse('register'), register, follow=True)

        # Make sure we can't use the same username twice
        assert r.context['form'].errors, "Form should throw errors."
Пример #2
0
    def test_username(self):
        """Test that we can submit a perfectly cromulent username.

        We verify that /:username then works as well.

        """
        email = '*****@*****.**'
        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)
        d = dict(email=email,
                 username='******',
                 first_name='Akaaaaaaash',
                 last_name='Desaaaaaaai',
                 password='******',
                 confirmp='tacoface',
                 optin=True)
        with browserid_mock.mock_browserid(email):
            r = self.client.post(reverse('register'), d)
        eq_(r.status_code, 302, "Problems if we didn't redirect...")
        u = User.objects.filter(email=d['email'])[0]
        eq_(u.username, 'mrfusion', "Username didn't get set.")

        r = self.mozillian_client.get(reverse('profile', args=['mrfusion']),
                                      follow=True)
        eq_(r.status_code, 200)
        eq_(r.context['profile'].user_id, u.id)
Пример #3
0
    def redeem_invite(self, invite, email):
        """Given an invite_url go to it and redeem an invite."""
        # Lets make sure we have a clean slate
        self.client.logout()
        assert (not User.objects.filter(email=email),
                    "User shouldn't be in database.")

        # We need to store the invite code in the session
        self.client.get(invite.get_url(), follow=True)

        # BrowserID needs an assertion not to be whiney
        d = dict(assertion=self.fake_assertion)
        with mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        # Now let's register
        d = dict(
            first_name='Akaaaaaaash',
            last_name='Desaaaaaaai',
            optin=True
        )
        with mock_browserid(email):
            self.client.post(reverse('register'), d, follow=True)

        # Return the New Users Profile
        invited_user_profile = User.objects.get(email=email).get_profile()
        return invited_user_profile
Пример #4
0
    def redeem_invite(self, invite, email):
        """Given an invite_url go to it and redeem an invite."""
        # Lets make sure we have a clean slate
        self.client.logout()
        assert not User.objects.filter(email=email), (
            "User shouldn't be in database.")

        # We need to store the invite code in the session
        self.client.get(invite.get_url(), follow=True)

        # BrowserID needs an assertion not to be whiney
        d = dict(assertion=self.fake_assertion)
        with mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        # Now let's register
        d = dict(first_name='Akaaaaaaash',
                 last_name='Desaaaaaaai',
                 username='******',
                 optin=True)
        with mock_browserid(email):
            self.client.post(reverse('register'), d, follow=True)

        # Return the New Users Profile
        invited_user_profile = User.objects.get(email=email).get_profile()
        return invited_user_profile
Пример #5
0
    def test_repeat_username(self):
        """Verify one cannot repeat email adresses."""
        register = dict(username='******',
                        first_name='Akaaaaaaash',
                        last_name='Desaaaaaaai',
                        optin=True)

        # Create first user
        email1 = '*****@*****.**'
        register.update(email=email1)
        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid(email1):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        with browserid_mock.mock_browserid(email1):
            self.client.post(reverse('register'), register, follow=True)

        self.client.logout()
        # Create a different user
        email2 = '*****@*****.**'
        register.update(email=email2)
        with browserid_mock.mock_browserid(email2):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        with browserid_mock.mock_browserid(email2):
            r = self.client.post(reverse('register'), register, follow=True)

        # Make sure we can't use the same username twice
        assert r.context['user_form'].errors, "Form should throw errors."
Пример #6
0
    def test_bad_username(self):
        """`about` is a terrible username, as are its silly friends.

        Let's make some stop words *and* analyze the routing system,
        whenever someone sets their username and verify that they can't
        be "about" or "help" or anything that is in use.
        """
        email = '*****@*****.**'
        badnames = getattr(settings, 'USERNAME_BLACKLIST')

        # BrowserID needs an assertion not to be whiney
        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        for name in badnames:
            d = dict(
                    email=email,
                    username=name,
                    first_name='Akaaaaaaash',
                    last_name='Desaaaaaaai',
                    optin=True
            )
            with browserid_mock.mock_browserid(email):
                r = self.client.post(reverse('register'), d)

            eq_(r.status_code, 200,
                'This form should fail for "%s", and say so.' % name)
            assert r.context['form'].errors, (
                "Didn't raise errors for %s" % name)
Пример #7
0
    def test_login(self):
        """Given an invite_url go to it and redeem an invite."""
        # Lettuce make sure we have a clean slate

        info = dict(first_name='Akaaaaaaash',
                    last_name='Desaaaaaaai',
                    optin=True)

        self.client.logout()
        u = User.objects.create(username='******', email=self.email)
        p = u.get_profile()

        u.first_name = info['first_name']
        u.last_name = ''
        u.save()
        p.save()

        # BrowserID needs an assertion not to be whiney
        d = dict(assertion='tofu')
        with browserid_mock.mock_browserid(self.email):
            r = self.client.post(reverse('browserid_verify'), d, follow=True)

        eq_(r.status_code, 200)

        # Now let's register

        with browserid_mock.mock_browserid(self.email):
            r = self.client.post(reverse('register'), info, follow=True)

        eq_(r.status_code, 200)
Пример #8
0
        def test_login(self):
            """Given an invite_url go to it and redeem an invite."""
            # Lettuce make sure we have a clean slate

            info = dict(
                first_name='Akaaaaaaash',
                last_name='Desaaaaaaai',
                optin=True
            )

            self.client.logout()
            u = User.objects.create(username='******', email=self.email)
            p = u.get_profile()

            u.first_name = info['first_name']
            u.last_name = ''
            u.save()
            p.save()

            # BrowserID needs an assertion not to be whiney
            d = dict(assertion='tofu')
            with browserid_mock.mock_browserid(self.email):
                r = self.client.post(reverse('browserid_verify'),
                                     d, follow=True)

            eq_(r.status_code, 200)

            # Now let's register

            with browserid_mock.mock_browserid(self.email):
                r = self.client.post(reverse('register'), info, follow=True)

            eq_(r.status_code, 200)
Пример #9
0
    def test_bad_username(self):
        """'about' is a terrible username, as are its silly friends.

        Let's make some stop words *and* analyze the routing system,
        whenever someone sets their username and verify that they can't
        be 'about' or 'help' or anything that is in use.
        """
        email = '*****@*****.**'
        badnames = UsernameBlacklist.objects.all().values_list('value',
                                                               flat=True)
        # BrowserID needs an assertion not to be whiney
        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        for name in badnames:
            d = dict(email=email,
                     username=name,
                     first_name='Akaaaaaaash',
                     last_name='Desaaaaaaai',
                     optin=True)
            with browserid_mock.mock_browserid(email):
                r = self.client.post(reverse('register'), d)

            eq_(r.status_code, 200,
                'This form should fail for "%s", and say so.' % name)
            assert r.context['user_form'].errors, (
                "Didn't raise errors for %s" % name)
Пример #10
0
    def test_username(self):
        """Test that we can submit a perfectly cromulent username.

        We verify that /:username then works as well.
        """
        email = '*****@*****.**'
        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)
        d = dict(
                 email=email,
                 username='******',
                 first_name='Akaaaaaaash',
                 last_name='Desaaaaaaai',
                 password='******',
                 confirmp='tacoface',
                 optin=True
        )
        with browserid_mock.mock_browserid(email):
            r = self.client.post(reverse('register'), d)
        eq_(r.status_code, 302, "Problems if we didn't redirect...")
        u = User.objects.filter(email=d['email'])[0]
        eq_(u.username, 'mrfusion', "Username didn't get set.")

        r = self.mozillian_client.get(reverse('profile', args=['mrfusion']),
                                              follow=True)
        eq_(r.status_code, 200)
        eq_(r.context['profile'].user_id, u.id)
Пример #11
0
    def test_mozillacom_registration(self):
        """Verify @mozilla.com users are auto-vouched and marked "staff"."""

        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid('*****@*****.**'):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        d = dict(username='******',
                 email='*****@*****.**',
                 first_name='Akaaaaaaash',
                 last_name='Desaaaaaaai',
                 optin=True)
        with browserid_mock.mock_browserid('*****@*****.**'):
            r = self.client.post(reverse('register'), d, follow=True)

        doc = pq(r.content)

        assert r.context['user'].get_profile().is_vouched, (
            "Moz.com should be auto-vouched")

        assert not doc('#pending-approval'), (
            'Moz.com profile page should not having pending vouch div.')

        assert r.context['user'].get_profile().groups.filter(
            name='staff'), ('Moz.com should belong to the "staff" group.')
Пример #12
0
    def test_nickname_changes_before_vouch(self):
        """Notify pre-vouched users of URL change from nickname
        changes.

        See: https://bugzilla.mozilla.org/show_bug.cgi?id=736556

        """
        d = dict(assertion=self.fake_assertion)
        email = "*****@*****.**"
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse("browserid_verify"), d, follow=True)

        # Note: No username supplied.
        d = dict(email=email, first_name="Tofu", last_name="Matt", optin=True)
        with browserid_mock.mock_browserid(email):
            r = self.client.post(reverse("register"), d, follow=True)

        assert r.context["user"].id, "User should be created"
        assert not r.context["user"].get_profile().is_vouched, "User should not be vouched"

        d["username"] = "******"
        r = self.client.post(reverse("profile.edit"), d, follow=True)
        assert "You changed your username;" in r.content, (
            "User should know that changing their username changes " "their URL."
        )
Пример #13
0
    def test_nickname_changes_before_vouch(self):
        """Notify pre-vouched users of URL change from nickname changes.

        See: https://bugzilla.mozilla.org/show_bug.cgi?id=736556"""
        d = dict(assertion=self.fake_assertion)
        email = '*****@*****.**'
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        # Note: No username supplied.
        d = dict(
                 email=email,
                 first_name='Tofu',
                 last_name='Matt',
                 optin=True
        )
        with browserid_mock.mock_browserid(email):
            r = self.client.post(reverse('register'), d, follow=True)

        doc = pq(r.content)

        assert r.context['user'].id, 'User should be created'
        assert not r.context['user'].get_profile().is_vouched, (
                'User should not be vouched')

        d['username'] = '******'
        r = self.client.post(reverse('profile.edit'), d, follow=True)

        assert 'You changed your username;' in r.content, (
                'User should know that changing their username changes '
                'their URL.')
Пример #14
0
    def test_mozillacom_registration(self):
        """Verify @mozilla.com users are auto-vouched and marked "staff"."""

        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid('*****@*****.**'):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        d = dict(
                 username='******',
                 email='*****@*****.**',
                 first_name='Akaaaaaaash',
                 last_name='Desaaaaaaai',
                 optin=True
        )
        with browserid_mock.mock_browserid('*****@*****.**'):
            r = self.client.post(reverse('register'), d, follow=True)

        doc = pq(r.content)

        assert r.context['user'].get_profile().is_vouched, (
                "Moz.com should be auto-vouched")

        assert not doc('#pending-approval'), (
                'Moz.com profile page should not having pending vouch div.')

        assert r.context['user'].get_profile().groups.filter(name='staff'), (
                'Moz.com should belong to the "staff" group.')
Пример #15
0
    def test_nickname_changes_before_vouch(self):
        """Notify pre-vouched users of URL change from nickname
        changes.

        See: https://bugzilla.mozilla.org/show_bug.cgi?id=736556

        """
        d = dict(assertion=self.fake_assertion)
        email = '*****@*****.**'
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        # Note: No username supplied.
        d = dict(email=email, first_name='Tofu', last_name='Matt', optin=True)
        with browserid_mock.mock_browserid(email):
            r = self.client.post(reverse('register'), d, follow=True)

        assert r.context['user'].id, 'User should be created'
        assert not r.context['user'].get_profile().is_vouched, (
            'User should not be vouched')

        d['username'] = '******'
        r = self.client.post(reverse('profile.edit'), d, follow=True)
        assert 'You changed your username;' in r.content, (
            'User should know that changing their username changes '
            'their URL.')
Пример #16
0
    def test_bad_username(self):
        """'about' is a terrible username, as are its silly friends.

        Let's make some stop words *and* analyze the routing system,
        whenever someone sets their username and verify that they can't
        be 'about' or 'help' or anything that is in use.
        """
        email = '*****@*****.**'
        badnames = UsernameBlacklist.objects.all().values_list('value',
                                                               flat=True)
        # BrowserID needs an assertion not to be whiney
        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        for name in badnames:
            d = dict(email=email,
                     username=name,
                     full_name='Akaaaaaaash Desaaaaaaai',
                     optin=True)
            with browserid_mock.mock_browserid(email):
                r = self.client.post(reverse('register'), d)

            eq_(r.status_code, 200,
                'This form should fail for "%s", and say so.' % name)
            assert r.context['user_form'].errors, (
                "Didn't raise errors for %s" % name)
Пример #17
0
    def test_username(self):
        """Test that we can submit a perfectly cromulent username.

        We verify that /:username then works as well.

        """
        email = "*****@*****.**"
        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse("browserid_verify"), d, follow=True)
        d = dict(
            email=email,
            username="******",
            first_name="Akaaaaaaash",
            last_name="Desaaaaaaai",
            password="******",
            confirmp="tacoface",
            optin=True,
        )
        with browserid_mock.mock_browserid(email):
            r = self.client.post(reverse("register"), d)
        eq_(r.status_code, 302, "Problems if we didn't redirect...")
        u = User.objects.filter(email=d["email"])[0]
        eq_(u.username, "mrfusion", "Username didn't get set.")

        r = self.mozillian_client.get(reverse("profile", args=["mrfusion"]), follow=True)
        eq_(r.status_code, 200)
        eq_(r.context["profile"].user_id, u.id)
Пример #18
0
    def test_username_characters(self):
        """Verify usernames can have digits/symbols, but nothing too insane."""
        email = '*****@*****.**'
        username = '******'
        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        d = dict(
                 email=email,
                 username=username,
                 first_name='Akaaaaaaash',
                 last_name='Desaaaaaaai',
                 password='******',
                 confirmp='tacoface',
                 optin=True
        )
        with browserid_mock.mock_browserid(email):
            r = self.client.post(reverse('register'), d)
        eq_(r.status_code, 302, (
                'Registration flow should finish with a redirect.'))
        u = User.objects.get(email=d['email'])
        eq_(u.username, username, 'Username should be set to "%s".' % username)

        r = self.mozillian_client.get(reverse('profile', args=[username]),
                                              follow=True)
        eq_(r.status_code, 200)
        eq_(r.context['profile'].user_id, u.id)

        # Now test a username with even weirder characters that we don't allow.
        bad_user_email = '*****@*****.**'
        bad_username = '******'
        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        d = dict(
                 email=bad_user_email,
                 username=bad_username,
                 first_name='Akaaaaaaash',
                 last_name='Desaaaaaaai',
                 password='******',
                 confirmp='tacoface',
                 optin=True
        )
        with browserid_mock.mock_browserid(email):
            r = self.client.post(reverse('register'), d)
        eq_(r.status_code, 302, (
                'Registration flow should fail; username is bad.'))
        assert not User.objects.filter(email=d['email']), (
                "User shouldn't exist; username was bad.")
Пример #19
0
    def test_username_characters(self):
        """Verify usernames can have digits/symbols, but nothing too
        insane.

        """
        email = '*****@*****.**'
        username = '******'
        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        d = dict(email=email,
                 username=username,
                 first_name='Akaaaaaaash',
                 last_name='Desaaaaaaai',
                 password='******',
                 confirmp='tacoface',
                 optin=True)
        with browserid_mock.mock_browserid(email):
            r = self.client.post(reverse('register'), d)
        eq_(r.status_code, 302,
            ('Registration flow should finish with a redirect.'))
        u = User.objects.get(email=d['email'])
        eq_(u.username, username, 'Username should be set to "%s".' % username)

        r = self.mozillian_client.get(reverse('profile', args=[username]),
                                      follow=True)
        eq_(r.status_code, 200)
        eq_(r.context['profile'].user_id, u.id)

        # Now test a username with even weirder characters that we don't allow.
        bad_user_email = '*****@*****.**'
        bad_username = '******'
        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        d = dict(email=bad_user_email,
                 username=bad_username,
                 first_name='Akaaaaaaash',
                 last_name='Desaaaaaaai',
                 password='******',
                 confirmp='tacoface',
                 optin=True)
        with browserid_mock.mock_browserid(email):
            r = self.client.post(reverse('register'), d)
        eq_(r.status_code, 302,
            ('Registration flow should fail; username is bad.'))
        assert not User.objects.filter(email=d['email']), (
            "User shouldn't exist; username was bad.")
Пример #20
0
    def test_plus_signs(self):
        email = '*****@*****.**'
        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        d = dict(username='******',
                 email=email,
                 full_name='Akaaaaaaash Desaaaaaaai',
                 optin=True)
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('register'), d, follow=True)

        assert User.objects.filter(email=d['email'])
Пример #21
0
    def test_plus_signs(self):
        email = '*****@*****.**'
        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)

        d = dict(username='******',
                 email=email,
                 first_name='Akaaaaaaash',
                 last_name='Desaaaaaaai',
                 password='******',
                 confirmp='tacoface',
                 optin=True)
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('register'), d, follow=True)

        assert User.objects.filter(email=d['email'])
Пример #22
0
    def test_plus_signs(self):
        email = "*****@*****.**"
        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse("browserid_verify"), d, follow=True)

        d = dict(
            username="******",
            email=email,
            first_name="Akaaaaaaash",
            last_name="Desaaaaaaai",
            password="******",
            confirmp="tacoface",
            optin=True,
        )
        with browserid_mock.mock_browserid(email):
            self.client.post(reverse("register"), d, follow=True)

        assert User.objects.filter(email=d["email"])
Пример #23
0
    def test_mozillacom_registration(self):
        """Verify @mozilla.com users are auto-vouched and marked "staff"."""

        d = dict(assertion=self.fake_assertion)
        with browserid_mock.mock_browserid("*****@*****.**"):
            self.client.post(reverse("browserid_verify"), d, follow=True)

        d = dict(
            username="******", email="*****@*****.**", first_name="Akaaaaaaash", last_name="Desaaaaaaai", optin=True
        )
        with browserid_mock.mock_browserid("*****@*****.**"):
            r = self.client.post(reverse("register"), d, follow=True)

        doc = pq(r.content)

        assert r.context["user"].get_profile().is_vouched, "Moz.com should be auto-vouched"

        assert not doc("#pending-approval"), "Moz.com profile page should not having pending vouch div."

        assert (
            r.context["user"].get_profile().groups.filter(name="staff")
        ), 'Moz.com should belong to the "staff" group.'
Пример #24
0
    def test_ircnick(self):
        username = "******"
        email = "*****@*****.**"
        register = dict(username=username, first_name="David", last_name="Teststhings", optin=True)
        d = {"assertion": self.fake_assertion}

        with browserid_mock.mock_browserid(email):
            self.client.post(reverse("browserid_verify"), d, follow=True)
            self.client.post(reverse("register"), register, follow=True)

        u = User.objects.filter(email=email)[0]
        p = u.get_profile()
        eq_(p.ircname, username, "IRCname should equal username")
Пример #25
0
    def test_blank_ircname(self):
        username = "******"
        email = "*****@*****.**"
        register = dict(username=username, first_name="David", last_name="Teststhings", optin=True)
        d = {"assertion": "rarrr"}

        with browserid_mock.mock_browserid(email):
            self.client.post(reverse("browserid_verify"), d, follow=True)
            self.client.post(reverse("register"), register, follow=True)

        u = User.objects.filter(email=email)[0]
        p = u.get_profile()
        p.ircname = ""
        eq_(p.ircname, "", "We need to allow IRCname to be blank")
Пример #26
0
    def test_userprofile(self):
        u = User.objects.create(username='******', email='*****@*****.**')

        UserProfile.objects.all().delete()

        # Somehow the User lacks a UserProfile
        self.assertRaises(UserProfile.DoesNotExist, u.get_profile)

        # Sign in
        with browserid_mock.mock_browserid(u.email):
            d = dict(assertion='qwer')
            self.client.post(reverse('browserid_verify'), d, follow=True)

        # Good to go
        assert u.get_profile()
Пример #27
0
    def test_userprofile(self):
        u = user()

        UserProfile.objects.all().delete()

        # Somehow the User lacks a UserProfile
        # Note that u.get_profile() caches in memory.
        self.assertRaises(UserProfile.DoesNotExist, lambda: u.userprofile)

        # Sign in
        with browserid_mock.mock_browserid(u.email):
            d = dict(assertion="qwer")
            self.client.post(reverse("browserid_verify"), d, follow=True)

        # Good to go
        assert u.get_profile()
Пример #28
0
    def test_userprofile(self):
        u = user()

        UserProfile.objects.all().delete()

        # Somehow the User lacks a UserProfile
        # Note that u.get_profile() caches in memory.
        self.assertRaises(UserProfile.DoesNotExist, lambda: u.userprofile)

        # Sign in
        with browserid_mock.mock_browserid(u.email):
            d = dict(assertion='qwer')
            self.client.post(reverse('browserid_verify'), d, follow=True)

        # Good to go
        assert u.get_profile()
Пример #29
0
    def test_blank_ircname(self):
        username = '******'
        email = '*****@*****.**'
        register = dict(username=username,
                        full_name='David Teststhings',
                        optin=True)
        d = {'assertion': 'rarrr'}

        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)
            self.client.post(reverse('register'), register, follow=True)

        u = User.objects.filter(email=email)[0]
        p = u.get_profile()
        p.ircname = ''
        eq_(p.ircname, '', 'We need to allow IRCname to be blank')
Пример #30
0
    def test_ircnick(self):
        username = '******'
        email = '*****@*****.**'
        register = dict(username=username,
                        first_name='David',
                        last_name='Teststhings',
                        optin=True)
        d = {'assertion': self.fake_assertion}

        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)
            self.client.post(reverse('register'), register, follow=True)

        u = User.objects.filter(email=email)[0]
        p = u.get_profile()
        eq_(p.ircname, username, 'IRCname should equal username')
Пример #31
0
    def test_ircnick(self):
        username = '******'
        email = '*****@*****.**'
        register = dict(username=username,
                        first_name='David',
                        last_name='Teststhings',
                        optin=True)
        d = {'assertion': self.fake_assertion}

        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)
            self.client.post(reverse('register'), register, follow=True)

        u = User.objects.filter(email=email)[0]
        p = u.get_profile()
        eq_(p.ircname, username, 'IRCname should equal username')
Пример #32
0
    def test_userprofile(self):
        u = User.objects.create(username='******', email='*****@*****.**')

        UserProfile.objects.all().delete()

        # Somehow the User lacks a UserProfile
        self.assertRaises(UserProfile.DoesNotExist,
                          u.get_profile)

        # Sign in
        with browserid_mock.mock_browserid(u.email):
            d = dict(assertion='qwer')
            self.client.post(reverse('browserid_verify'), d, follow=True)

        # Good to go
        assert u.get_profile()
Пример #33
0
    def test_blank_ircname(self):
        username = '******'
        email = '*****@*****.**'
        register = dict(username=username,
                        first_name='David',
                        last_name='Teststhings',
                        optin=True)
        d = {'assertion': 'rarrr'}

        with browserid_mock.mock_browserid(email):
            self.client.post(reverse('browserid_verify'), d, follow=True)
            self.client.post(reverse('register'), register, follow=True)

        u = User.objects.filter(email=email)[0]
        p = u.get_profile()
        p.ircname = ''
        eq_(p.ircname, '', 'We need to allow IRCname to be blank')