示例#1
0
 def test_update_cur_item(self):
     """
         **test_update_cur_item** tests that an object is called and an attribute is modified
     """
     with patch("hunts.models.HuntProg.objects.get") as geth:
         geth.return_value = MagicMock(cur_item_num=2)
         attrs = {"save.return_value": None}
         geth.return_value.configure_mock(**attrs)
         models.update_cur_item("test", "testu", 2)
         assert geth.return_value.save.called
示例#2
0
def render_correct(request):
    """
        :param: HttpRequest
        :rtype: HttpResponse
        Render the correct answer's page with some fun facts and the item's image.
    """
    global TEMP
    global glob_hunt_id
    num = TEMP[0][2]
    uname = request.user.username
    update_cur_item(glob_hunt_id, uname, num)
    return render_to_response("hunts/correct.html", {"url": TEMP[0][4], "fact": TEMP[0][5]})