def test_confirm_resend(self): # User doesn't have a confirmation code url = reverse('users.confirm.resend', args=[self.user.id]) r = self.client.get(url, follow=True) anon = PyQuery(r.content)('body').attr('data-anonymous') self.assertTrue(anon) self.user_profile.confirmationcode = "code" self.user_profile.save()
def test_login_link(self): r = self.client.get(reverse('home'), follow=True) doc = PyQuery(r.content) next = urllib.urlencode({'to': '/en-US/firefox/'}) eq_('/en-US/firefox/users/login?%s' % next, doc('.account.anonymous a')[1].attrib['href'])
def title_eq(url, alt, text): response = self.client.get(url, follow=True) doc = PyQuery(response.content) eq_(alt, doc('.site-title img').attr('alt')) eq_(text, doc('.site-title').text())
def get_links(id): """Grab profile, return edit links.""" url = reverse('users.profile', args=[id]) r = self.client.get(url) return PyQuery(r.content)('p.editprofile a')
def get_homepage(): response = self.client.get('/', follow=True) return PyQuery(response.content)
def check(expected): response = self.client.get('/', follow=True) anon = PyQuery(response.content)('body').attr('data-anonymous') eq_(anon, expected)