def callUpVote(userID, postID): """Increases number of up votes(if feasable) Args: postID:Votes - The id of the post which is being up voted on userID:Votes - The id of the user who upvoted Return: N/A Raises: when this method is called, calls on the upVote method from Votes class """ Votes.upvote(userID, postID) print(0)
def setUp(self): """Setup new databse for test methods Populate the database with at least one record per table for testing """ self.db_fd, project.app.config['DATABASE'] = tempfile.mkstemp() project.app.testing = True self.app = project.app.test_client() with project.app.app_context(): db.Database().create_tables() user.createUser('adminTest', 'tcg1134', '', '') user.createUser('adminTest2', 'gct2334', '', '') Group.createGroup('TestGroup', 'adminTest2') topic.insertTopic('TestTopic', 'adminTest2', '1') post.insertPost(1, 'adminTest2', 'TestPost', 'Some random text') subscription.addToSub(1, 1) notification.sendNotif("post", 1) Votes.upvote(1, 1)