Ejemplo n.º 1
0
 def test_set_HuntsData(self):  # DONE
     """
         **test_set_HuntsData this test creates a mock object
         **then tests that the correct values are retrieved
     """
     with patch("hunts.models.Hunts.objects.get") as hunts_obj:
         hunts_obj.return_value = MagicMock()
         hunts_obj.return_value.Title = "hunt title test"
         hunts_obj.return_value.Start = "hunt start test"
         id_hunt = "123"
         models.set_HuntsData(id_hunt)
Ejemplo n.º 2
0
def render_hunt(request, given_id):
    """
        :param: HttpRequest, interger id
        :rtype: HttpResponse
        This function gets triggered with the appropriate hunt id once a user chooses
        hunt from the categories page. It sets the hunt's data (title and starting location),
        and stores the items data in global var TEMP list.
        Finally, it renders the hunt's welcome page.
    """
    global TEMP
    global glob_hunt_id
    glob_hunt_id = given_id
    hunt_dict = set_HuntsData(given_id)
    TEMP = set_ItemsData(given_id)
    hunt_title = hunt_dict["hunt title"]
    hunt_start = hunt_dict["hunt start"]
    uname = request.user.username
    init_huntprog(given_id, uname)
    return render_to_response("hunts/hunt.html", {"title": hunt_title, "start_pt": hunt_start, "user": request.user})