Exemplo n.º 1
0
Arquivo: tests.py Projeto: league/l3ms
    def test_profile_privileges(self):
        self.assertTrue(self.u1.is_staff)  # Alice is staff
        self.login_helper(self.u1, self.p1)
        r = self.client.get(profile_of(self.u1))  # my own
        self.assertTrue(r.context["privileged"])
        r = self.client.get(profile_of(self.u2))  # someone else
        self.assertTrue(r.context["privileged"])

        self.assertFalse(self.u2.is_staff)  # Bob is not staff
        self.login_helper(self.u2, self.p2)
        r = self.client.get(profile_of(self.u2))  # my own
        self.assertTrue(r.context["privileged"])
        r = self.client.get(profile_of(self.u1))  # someone else
        self.assertFalse(r.context["privileged"])
Exemplo n.º 2
0
Arquivo: tests.py Projeto: league/l3ms
 def test_profiles(self):
     self.login_helper(self.u1, self.p1)
     r = self.client.get(reverse("home"))
     self.assertContains(r, self.u1.username)
     r = self.client.get(profile_of(self.u2))
     self.assertContains(r, self.u2.username)
Exemplo n.º 3
0
Arquivo: tests.py Projeto: league/l3ms
 def test_logins_required(self):
     for p in [reverse("home"), profile_of(self.u2)]:
         self.client.logout()
         self.test_login_required(p)