示例#1
0
class TestAPrivateWishList(TestCase):
    def setUp(self):
        self.owner = User(id=1)
        self.another_user = User(id=2)
        self.wishlist = WishList(owner=self.owner)

    def test_is_visible_only_to_its_owner(self):
        self.assertTrue(self.wishlist.is_allowed_to_see(self.owner))
        self.assertFalse(self.wishlist.is_allowed_to_see(self.another_user))

    def test_can_only_be_edited_by_its_owner(self):
        self.assertTrue(self.wishlist.is_allowed_to_edit(self.owner))
        self.assertFalse(self.wishlist.is_allowed_to_edit(self.another_user))
示例#2
0
class TestASharedWishList(TestCase):
    def setUp(self):
        self.wishlist = WishList(visibility=WishList.SHARED)

    def test_is_visible_to_anyone(self):
        user = User()
        self.assertTrue(self.wishlist.is_allowed_to_see(user))
示例#3
0
class TestAPublicWishList(TestCase):
    def setUp(self):
        self.wishlist = WishList(visibility=WishList.PUBLIC)

    def test_is_visible_to_anyone(self):
        user = User()
        self.assertTrue(self.wishlist.is_allowed_to_see(user))
示例#4
0
 def test_can_generate_a_random_key(self):
     key = WishList.random_key(6)
     self.assertTrue(len(key) == 6)
示例#5
0
 def setUp(self):
     self.owner = User(id=1)
     self.another_user = User(id=2)
     self.wishlist = WishList(owner=self.owner)
示例#6
0
 def setUp(self):
     self.wishlist = WishList(visibility=WishList.SHARED)
示例#7
0
 def setUp(self):
     self.wishlist = WishList(visibility=WishList.PUBLIC)