def test_has_permission_to_delete_guest(): set_user(users.find_by_id(2)) # invited by normal1 entries.do_guest_entry(1, "name", "comment") # check... set_user(users.find_by_id(1)) # god assert entries.has_permission_to_delete_guest(1) set_user(users.find_by_id(2)) # normal1 assert entries.has_permission_to_delete_guest(1) set_user(users.find_by_id(3)) # normal2 assert not entries.has_permission_to_delete_guest(1) set_user(users.find_by_id(4)) # normal3 assert not entries.has_permission_to_delete_guest(1)
def setup_testdata(): users.insert("foo", "passwd1", 1, 0x0) u = users.find_by_id(1) u.joined = datetime(2011, 1, 1) set_user(u) d = datetime(2012, 1, 1) schedules.insert(schedules.TYPE_PRACTICE, d + timedelta(days=1), "p1") schedules.insert(schedules.TYPE_PRACTICE, d + timedelta(days=2), "p2") schedules.insert(schedules.TYPE_PRACTICE, d + timedelta(days=3), "p3") schedules.insert(schedules.TYPE_PRACTICE, d + timedelta(days=4), "p4") schedules.insert(schedules.TYPE_PRACTICE, d + timedelta(days=5), "p5") schedules.insert(schedules.TYPE_GAME, d + timedelta(days=1), "g1") schedules.insert(schedules.TYPE_GAME, d + timedelta(days=2), "g2") schedules.insert(schedules.TYPE_GAME, d + timedelta(days=3), "g3") schedules.insert(schedules.TYPE_GAME, d + timedelta(days=4), "g4") schedules.insert(schedules.TYPE_GAME, d + timedelta(days=5), "g5") schedules.insert(schedules.TYPE_EVENT, d + timedelta(days=1), "e1") schedules.insert(schedules.TYPE_EVENT, d + timedelta(days=2), "e2") schedules.insert(schedules.TYPE_EVENT, d + timedelta(days=3), "e3") schedules.insert(schedules.TYPE_EVENT, d + timedelta(days=4), "e4") schedules.insert(schedules.TYPE_EVENT, d + timedelta(days=5), "e5")
def impl(): users.insert("foo", "passwd1", 1, 0x0) set_user(users.find_by_id(1)) for i in range(count): bbs.post(u"あいうえお" + str(i))