Exemple #1
0
    def test_gamemanager_query_get(self):
        gameManager = GameManager("Jonathan", ["Omar", "Joey", "Salekh"])
        q = gameManager.get_suggestions("dogfish")
        # Check that the keys() of answers received correspond to the respondents
        del q['Jonathan']
        del q['if_valid']
        self.assertEqual(sorted(q.keys()),sorted(gameManager.get_respondents()))

        # Check to see if suggestions are shuffled:
        p1, p2, p3 = q.keys()
        self.assertEqual( (q[p1] != q[p2] != q[p3]), True)
def test_GameManagerQueryGet():
    """
    Here we test the GameManager get_suggestions method
    We expect to see four answers (response from server) that are shuffled
    If they are not shuffled answers we will throw an error.
    """
    gameManager = GameManager("Jonathan", ["Omar", "Joey", "Salekh"])

    q = gameManager.get_suggestions("dogfish")
    # Check that the keys() of answers received correspond to the respondents
    del q['Jonathan']
    del q['if_valid']
    assert (sorted(q.keys()) == sorted(gameManager.get_respondents()))

    # Check to see if suggestions are shuffled:
    p1, p2, p3 = q.keys()
    assert (q[p1] != q[p2] != q[p3])