Ejemplo n.º 1
0
 def test_in_show_grades_period(self):
     term = get_specific_term(2013, "winter")
     now_request = self.get_request_for_date('2013-03-27')
     self.assertTrue(in_show_grades_period(term, now_request))
     # spring quarter starts
     now_request = self.get_request_for_date('2013-04-01')
     self.assertFalse(in_show_grades_period(term, now_request))
Ejemplo n.º 2
0
 def test_in_show_grades_period(self):
     term = get_specific_term(2013, "winter")
     now_request = self.get_request_for_date('2013-03-27')
     self.assertTrue(in_show_grades_period(term, now_request))
     # spring quarter starts
     now_request = self.get_request_for_date('2013-04-01')
     self.assertFalse(in_show_grades_period(term, now_request))
Ejemplo n.º 3
0
 def test_in_show_grades_period(self):
     with self.settings(RESTCLIENTS_SWS_DAO_CLASS=FDAO_SWS):
         term = _get_term_by_year_and_quarter(2013, "winter")
         now_request = RequestFactory().get("/")
         now_request.session = {}
         now_request.session["myuw_override_date"] = "2013-03-27"
         self.assertTrue(in_show_grades_period(term, now_request))
         now_request.session = {}
         # spring quarter starts
         now_request.session["myuw_override_date"] = "2013-04-01"
         self.assertFalse(in_show_grades_period(term, now_request))
Ejemplo n.º 4
0
    def GET(self, request, year, quarter, summer_term=None):
        """
        GET returns 200 with course section schedule details of
        the given year, quarter.
        Return the course sections of full term and matched term
        if a specific summer-term is given
        @return class schedule data in json format
                status 404: no schedule found (not registered)
                status 543: data error
        """
        timer = Timer()
        try:
            smr_term = ""
            if summer_term and len(summer_term) > 1:
                smr_term = summer_term.title()

            request_term = get_specific_term(year, quarter)

            if is_past(request_term, request):
                if not in_show_grades_period(request_term, request):
                    log_msg(logger, timer, "Future term has pasted")
                    return invalid_future_term()

            return self.make_http_resp(timer, request_term, request, smr_term)
        except Exception:
            return handle_exception(logger, timer, traceback)
Ejemplo n.º 5
0
    def GET(self, request, year, quarter, summer_term=None):
        """
        GET returns 200 with course section schedule details of
        the given year, quarter.
        Return the course sections of full term and matched term
        if a specific summer-term is given
        @return class schedule data in json format
                status 404: no schedule found (not registered)
                status 543: data error
        """
        timer = Timer()
        try:
            smr_term = ""
            if summer_term and len(summer_term) > 1:
                smr_term = summer_term.title()

            request_term = get_specific_term(year, quarter)

            if is_past(request_term, request):
                if not in_show_grades_period(request_term, request):
                    log_msg(logger, timer, "Future term has pasted")
                    return invalid_future_term()

            return self.make_http_resp(timer, request_term,
                                       request, smr_term)
        except Exception:
            return handle_exception(logger, timer, traceback)
Ejemplo n.º 6
0
    def GET(self, request, year, quarter, summer_term=None):
        """
        GET returns 200 with course section schedule details of
        the given year, quarter.
        Return the course sections of full term and matched term
        if a specific summer-term is given
        """
        timer = Timer()
        smr_term = ""
        if summer_term and len(summer_term) > 1:
            smr_term = summer_term.title()

        request_term = get_quarter(year, quarter)
        if not request_term:
            return HttpResponse(status=404)

        if is_past(request_term, request):
            if not in_show_grades_period(request_term, request):
                return HttpResponse(status=410)

        return self.make_http_resp(
            logging.getLogger(__name__),
            timer,
            request_term,
            request,
            smr_term)