Ejemplo n.º 1
0
    def test_salt(self):
        userprofile = UserProfile(user=self.user)
        userprofile.save()
        salt = userprofile.current_salt

        self.client.login(username="******", password="******")
        url = reverse("salt")

        response = self.client.get(url)
        self.assertEquals(response.status_code, 200)
        self.assertTemplateUsed(response, "salt.dhtml")

        response = self.client.post(url, {"yes": "true"})

        userprofile = UserProfile.objects.get(pk=userprofile.id)
        self.assertNotEquals(userprofile.current_salt, salt)
Ejemplo n.º 2
0
    def test_salt(self):
        userprofile = UserProfile(user=self.user)
        userprofile.save()
        salt = userprofile.current_salt

        self.client.login(username='******', password='******')
        url = reverse("salt")

        response = self.client.get(url)
        self.assertEquals(response.status_code, 200)
        self.assertTemplateUsed(response, "salt.dhtml")

        response = self.client.post(url, {'yes': 'true'})

        userprofile = UserProfile.objects.get(pk=userprofile.id)
        self.assertNotEquals(userprofile.current_salt, salt)
Ejemplo n.º 3
0
class UserProfileTest(TestCase):
    def setUp(self):
        self.user = User(username="******")
        self.user.save()
        self.wklejka = Wklejka(user=self.user, body="foobarbaz").save()
        self.userprofile = UserProfile(user=self.user)
        self.userprofile.save()

    def test_username(self):
        self.assertEquals(self.userprofile.username(), "foobar")

    def test_get_wklejki(self):
        wklejki = self.userprofile.get_wklejki().all()
        self.assertEquals(wklejki.count(), 1)
        self.assertEquals(wklejki[0].body, "foobarbaz")

    def test_generate_new_salt(self):
        userprofile_id = self.userprofile.id
        new_salt = self.userprofile.generate_new_salt()
        new_profile = UserProfile.objects.get(current_salt=new_salt)
        self.assertEqual(userprofile_id, new_profile.id)
Ejemplo n.º 4
0
 def setUp(self):
     self.user = User(username="******")
     self.user.save()
     self.wklejka = Wklejka(user=self.user, body="foobarbaz").save()
     self.userprofile = UserProfile(user=self.user)
     self.userprofile.save()