Пример #1
0
    def test_cant_have_multiple_parent_accounts(self):
        parent = self.make_user("*****@*****.**")
        parent2 = self.make_user("*****@*****.**")
        child = self.make_child_account(parent, "child")

        with mock.patch("logging.error") as errorlog:
            # Going to fail because the child already has a parent.
            self.assertFalse(ParentChildPair.make_bond(parent2, child))
            self.assertEquals(1, errorlog.call_count)

        self.assertTrue(ParentChildPair.is_pair(parent, child))
        self.assertFalse(ParentChildPair.is_pair(parent2, child))
Пример #2
0
 def test_invalid_bonds(self):
     too_old = self.make_user("*****@*****.**")
     parent = self.make_user("*****@*****.**")
     with mock.patch("logging.error") as errorlog:
         self.assertFalse(ParentChildPair.make_bond(parent, too_old))
         self.assertEquals(1, errorlog.call_count)