def test_profile_friend(app, journal_user): user = db_utils.create_user() cookie = db_utils.create_session(user) db_utils.create_friendship(user, journal_user) resp = app.get('/~journal_test', headers={'Cookie': cookie}) assert resp.html.find(id='user-journal').h4.string == u'Recent journal'
def test_friends_only(self): user1 = db_utils.create_user() user2 = db_utils.create_user() db_utils.create_submission(user1, rating=ratings.GENERAL.code, settings=CharSettings({'friends-only'}, {}, {})) # poster can view their submission self.assertEqual( 1, len(submission.select_list(user1, ratings.GENERAL.code, 10))) # but a non-friend or a non-logged in user cannot self.assertEqual( 0, len(submission.select_list(None, ratings.GENERAL.code, 10))) self.assertEqual( 0, len(submission.select_list(user2, ratings.GENERAL.code, 10))) # user with a pending friendship cannot view db_utils.create_friendship(user1, user2, settings=CharSettings({'pending'}, {}, {})) self.assertEqual( 0, len(submission.select_list(user2, ratings.GENERAL.code, 10))) # but a friend can d.sessionmaker().query(users.Friendship).delete() db_utils.create_friendship(user1, user2) self.assertEqual( 1, len(submission.select_list(user2, ratings.GENERAL.code, 10)))
def test_friends_only(self): user1 = db_utils.create_user() user2 = db_utils.create_user() db_utils.create_submission(user1, rating=ratings.GENERAL.code, settings=CharSettings({'friends-only'}, {}, {})) # poster can view their submission self.assertEqual( 1, len(submission.select_list(user1, ratings.GENERAL.code, 10))) # but a non-friend or a non-logged in user cannot self.assertEqual( 0, len(submission.select_list(None, ratings.GENERAL.code, 10))) self.assertEqual( 0, len(submission.select_list(user2, ratings.GENERAL.code, 10))) # user with a pending friendship cannot view db_utils.create_friendship(user1, user2, settings=CharSettings({'pending'}, {}, {})) self.assertEqual( 0, len(submission.select_list(user2, ratings.GENERAL.code, 10))) # but a friend can d.sessionmaker().query(users.Friendship).delete() db_utils.create_friendship(user1, user2) self.assertEqual( 1, len(submission.select_list(user2, ratings.GENERAL.code, 10)))
def test_profile_friend(app, journal_user): user = db_utils.create_user() cookie = db_utils.create_session(user) db_utils.create_friendship(user, journal_user) resp = app.get('/~journal_test', headers={'Cookie': cookie}) assert resp.html.find(id='user-journal').h4.string == u'Recent journal'
def setUp(self): self.user1 = db_utils.create_user() self.user2 = db_utils.create_user() self.friend1 = db_utils.create_user() db_utils.create_friendship(self.user1, self.friend1) self.count = 20 self.pivot = 5 s = db_utils.create_journals(self.count, self.user1, ratings.GENERAL.code) self.pivotid = s[self.pivot]
def setUp(self): self.user1 = db_utils.create_user() self.user2 = db_utils.create_user() self.friend1 = db_utils.create_user() db_utils.create_friendship(self.user1, self.friend1) self.count = 20 self.pivot = 5 s = db_utils.create_characters(self.count, self.user1, ratings.GENERAL.code) self.pivotid = s[self.pivot]
def setUp(self): # userid of the owner of a submission. self.owner = db_utils.create_user() # userid of a friended follower. self.friend = db_utils.create_user() db_utils.create_follow(self.friend, self.owner) db_utils.create_friendship(self.owner, self.friend) # userid of a non-friended follower. self.nonfriend = db_utils.create_user() db_utils.create_follow(self.nonfriend, self.owner) # userid of an ignored follower. self.ignored = db_utils.create_user() db_utils.create_follow(self.ignored, self.owner) db_utils.create_ignoreuser(self.owner, self.ignored)
def setUp(self): # userid of the owner of a submission. self.owner = db_utils.create_user() # userid of a friended follower. self.friend = db_utils.create_user() db_utils.create_follow(self.friend, self.owner) db_utils.create_friendship(self.owner, self.friend) # userid of a non-friended follower. self.nonfriend = db_utils.create_user() db_utils.create_follow(self.nonfriend, self.owner) # userid of an ignored follower. self.ignored = db_utils.create_user() db_utils.create_follow(self.ignored, self.owner) db_utils.create_ignoreuser(self.owner, self.ignored)