Пример #1
0
 def test_invalid_country(self):
     """Not every country is a real country."""
     u = user()
     self.client.login(email=u.email, password='******')
     data = {'country': 'xyz', 'last_name': 'Foobar'}
     response = self.client.post(reverse('profile.edit'), data)
     eq_(400, response.status_code)
Пример #2
0
 def test_invalid_country(self):
     """Not every country is a real country."""
     u = user()
     self.client.login(email=u.email, password="******")
     data = {"country": "xyz", "last_name": "Foobar"}
     response = self.client.post(reverse("profile.edit"), data)
     eq_(400, response.status_code)
Пример #3
0
 def test_invalid_country(self):
     """Not every country is a real country."""
     u = user()
     self.client.login(email=u.email, password='******')
     data = {'country': 'xyz', 'last_name': 'Foobar'}
     response = self.client.post(reverse('profile.edit'), data)
     eq_(400, response.status_code)
Пример #4
0
 def test_has_country(self):
     u = user(username='******')
     p = u.get_profile()
     p.country = 'us'
     p.save()
     assert self.client.login(email=u.email)
     r = self.client.get(reverse('profile', args=[u.username]), follow=True)
     self.assertContains(r, '<dt>Location</dt>')
Пример #5
0
 def test_has_country(self):
     u = user(username='******')
     p = u.get_profile()
     p.country = 'us'
     p.save()
     assert self.client.login(email=u.email)
     r = self.client.get(reverse('profile', args=[u.username]), follow=True)
     self.assertContains(r, '<dt>Location</dt>')
Пример #6
0
    def test_username_filled_in(self):
        """The username field should have a type and value."""
        newbie = user(username='******', email='*****@*****.**')

        url = reverse('profile.edit')
        assert self.client.login(email=newbie.email)
        response = self.client.get(url, follow=True)

        eq_(200, response.status_code)
        doc = pq(response.content)
        field = doc('#id_username')[0]
        eq_('input', field.tag)
        assert 'value' in field.attrib
        eq_('text', field.attrib['type'])
        eq_(newbie.username, field.attrib['value'])
Пример #7
0
    def test_username_filled_in(self):
        """The username field should have a type and value."""
        newbie = user(username="******", email="*****@*****.**")

        url = reverse("profile.edit")
        assert self.client.login(email=newbie.email)
        response = self.client.get(url, follow=True)

        eq_(200, response.status_code)
        doc = pq(response.content)
        field = doc("#id_username")[0]
        eq_("input", field.tag)
        assert "value" in field.attrib
        eq_("text", field.attrib["type"])
        eq_(newbie.username, field.attrib["value"])
Пример #8
0
    def test_username_filled_in(self):
        """The username field should have a type and value."""
        newbie = user(username='******', email='*****@*****.**')

        url = reverse('profile.edit')
        assert self.client.login(email=newbie.email)
        response = self.client.get(url, follow=True)

        eq_(200, response.status_code)
        doc = pq(response.content)
        field = doc('#id_username')[0]
        eq_('input', field.tag)
        assert 'value' in field.attrib
        eq_('text', field.attrib['type'])
        eq_(newbie.username, field.attrib['value'])
Пример #9
0
    def test_geographic_fields_increasing(self):
        """Geographic fields exist and require increasing specificity."""
        u = user()
        self.client.login(email=u.email, password='******')
        data = {'city': 'New York', 'full_name': 'Foobar'}
        url = reverse('profile.edit')
        response = self.client.post(url, data)
        eq_(400, response.status_code)

        data.update({'region': 'New York'})
        response = self.client.post(url, data)
        eq_(400, response.status_code)

        data.update({'country': 'us'})
        response = self.client.post(url, data, follow=True)
        eq_(200, response.status_code)
Пример #10
0
    def test_geographic_fields_increasing(self):
        """Geographic fields exist and require increasing specificity."""
        u = user()
        self.client.login(email=u.email, password='******')
        # For some reason last_name is a required field.
        data = {'city': 'New York', 'last_name': 'Foobar'}
        url = reverse('profile.edit')
        response = self.client.post(url, data)
        eq_(400, response.status_code)

        data.update({'region': 'New York'})
        response = self.client.post(url, data)
        eq_(400, response.status_code)

        data.update({'country': 'us'})
        response = self.client.post(url, data, follow=True)
        eq_(200, response.status_code)
Пример #11
0
    def test_geographic_fields_increasing(self):
        """Geographic fields exist and require increasing specificity."""
        u = user()
        self.client.login(email=u.email, password="******")
        # For some reason last_name is a required field.
        data = {"city": "New York", "last_name": "Foobar"}
        url = reverse("profile.edit")
        response = self.client.post(url, data)
        eq_(400, response.status_code)

        data.update({"region": "New York"})
        response = self.client.post(url, data)
        eq_(400, response.status_code)

        data.update({"country": "us"})
        response = self.client.post(url, data, follow=True)
        eq_(200, response.status_code)