示例#1
0
 def test_owner_delete(self):
     self.assertIn(self.pm1,
                   pm_list(testing.DummyRequest(user=self.user1))["pms"])
     pm_delete(
         self.mockRequest(user=self.user1, matchdict={"id": self.pm1.id}))
     self.assertNotIn(self.pm1,
                      pm_list(testing.DummyRequest(user=self.user1))["pms"])
示例#2
0
 def test_other_delete(self):
     DBSession.add(
         self.user2
     )  # somehow this ends up not in the session after setUp() o_O
     self.assertIn(self.pm1,
                   pm_list(testing.DummyRequest(user=self.user1))["pms"])
     self.assertRaises(
         HTTPForbidden, pm_delete,
         self.mockRequest(user=self.user2, matchdict={"id": self.pm1.id}))
     self.assertIn(self.pm1,
                   pm_list(testing.DummyRequest(user=self.user1))["pms"])
示例#3
0
文件: pm.py 项目: Azula/votabo
 def test_valid_send(self):
     DBSession.add(self.user0)
     request = self.mockRequest(user=self.user0, POST={"to": u"test-user1", "subject": u"message~", "message": u"here is some text :3"})
     info = pm_create(request)
     
     info = pm_list(testing.DummyRequest(user=self.user1))
     self.assertIn("message~", [pm.subject for pm in info["pms"]])
示例#4
0
    def test_valid_send(self):
        DBSession.add(self.user0)
        request = self.mockRequest(user=self.user0,
                                   POST={
                                       "to": u"test-user1",
                                       "subject": u"message~",
                                       "message": u"here is some text :3"
                                   })
        info = pm_create(request)

        info = pm_list(testing.DummyRequest(user=self.user1))
        self.assertIn("message~", [pm.subject for pm in info["pms"]])
示例#5
0
 def test_basic(self):
     request = testing.DummyRequest(user=self.user1)
     info = pm_list(request)
     self.assertIn(self.pm1, info["pms"])
     self.assertIn(self.pm3, info["pms"])
示例#6
0
文件: pm.py 项目: Azula/votabo
 def test_other_delete(self):
     DBSession.add(self.user2)  # somehow this ends up not in the session after setUp() o_O
     self.assertIn(self.pm1, pm_list(testing.DummyRequest(user=self.user1))["pms"])
     self.assertRaises(HTTPForbidden, pm_delete, self.mockRequest(user=self.user2, matchdict={"id": self.pm1.id}))
     self.assertIn(self.pm1, pm_list(testing.DummyRequest(user=self.user1))["pms"])
示例#7
0
文件: pm.py 项目: Azula/votabo
 def test_admin_delete(self):
     self.assertIn(self.pm1, pm_list(testing.DummyRequest(user=self.user1))["pms"])
     pm_delete(self.mockRequest(user=self.user0, matchdict={"id": self.pm1.id}))
     self.assertNotIn(self.pm1, pm_list(testing.DummyRequest(user=self.user1))["pms"])
示例#8
0
文件: pm.py 项目: Azula/votabo
 def test_basic(self):
     request = testing.DummyRequest(user=self.user1)
     info = pm_list(request)
     self.assertIn(self.pm1, info["pms"])
     self.assertIn(self.pm3, info["pms"])