def callDownVote(userID, postID):
    """Increases number of down votes(if feasable)

    Args:
        postID:Votes - The id of the post which is being down voted on
        userID:Votes - The id of the user who down voted

    Return:
        N/A

    Raises:

        when this method is called, calls on downVote method from Votes class
	"""
    Votes.downvote(userID, postID)
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 test_get_dv(self):
        """
	Tests the get_dv function to see if the function returns the correct number
        down votes for a given post
        """
        with project.app.app_context():
            self.assertEqual(Votes.get_dv(1), 0)
    def test_checkvotevalue(self):
        """
	Tests the checkvotevalue function to see if it correctly restricts a user
        from casting the same vote (up/down) on a particular post, more than once
        """
        with project.app.app_context():
            self.assertTrue(Votes.checkvotevalue(1, 1, 'up'))
    def test_ifEmpty(self):
        """
	Tests the ifEmpty function to see if a certain post has been voted up/down
        by any user yet
        """
        with project.app.app_context():
            self.assertFalse(Votes.ifEmpty(1))
 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)
def getUpVotes(postID):
    """Retreives the number of up votes for a given post

	Args:
	postID:Votes - the post ID from which the up votes is required

	Return:
	number of upvotes

	Raises:

	"""
    return Votes.get_uv(postID)
def getVotedUsers(postId):
    """Gives a list of all the users who voted for a particular post

	Args:
	    postID:Votes - the post ID from which the voted users must be seen

	Return:
	    number of upvotes

	Raises:

	"""
    return Votes.votedUsers(postID)