예제 #1
0
    def getURL(self, url, headers):
        response = get_mockdata_url("bridge", "file", url, headers)
        if response.status == 200:
            return response

        new_url = url + ".GET"
        return get_mockdata_url("bridge", "file", url, headers)
예제 #2
0
    def getURL(self, url, headers):
        response = get_mockdata_url("sws", "file", url, headers)

        if "/student/v5/notice" in url:
            self._make_notice_date(response)

        # This is to enable mock data grading.
        if (re.match("/student/v\d/term/current.json", url) or
                re.match("/student/v\d/term/2013,spring.json", url)):
            now = datetime.now()
            tomorrow = now + timedelta(days=1)
            yesterday = now - timedelta(days=1)
            json_data = json.loads(response.data)

            json_data["GradeSubmissionDeadline"] =\
                tomorrow.strftime("%Y-%m-%dT17:00:00")
            json_data["GradingPeriodClose"] =\
                tomorrow.strftime("%Y-%m-%dT17:00:00")
            json_data["GradingPeriodOpen"] =\
                yesterday.strftime("%Y-%m-%dT17:00:00")
            json_data["GradingPeriodOpenATerm"] =\
                yesterday.strftime("%Y-%m-%dT17:00:00")

            response.data = json.dumps(json_data)

        return response
예제 #3
0
    def getURL(self, url, headers):
        response = get_mockdata_url("sws", "file", url, headers)

        if "/student/v5/notice" in url:
            self._make_notice_date(response)

        # This is to enable mock data grading.
        if (re.match("/student/v\d/term/current.json", url)
                or re.match("/student/v\d/term/2013,spring.json", url)):
            now = datetime.now()
            tomorrow = now + timedelta(days=1)
            yesterday = now - timedelta(days=1)
            json_data = json.loads(response.data)

            json_data["GradeSubmissionDeadline"] =\
                tomorrow.strftime("%Y-%m-%dT17:00:00")
            json_data["GradingPeriodClose"] =\
                tomorrow.strftime("%Y-%m-%dT17:00:00")
            json_data["GradingPeriodOpen"] =\
                yesterday.strftime("%Y-%m-%dT17:00:00")
            json_data["GradingPeriodOpenATerm"] =\
                yesterday.strftime("%Y-%m-%dT17:00:00")

            response.data = json.dumps(json_data)

        return response
예제 #4
0
 def getURL(self, url, headers):
     if url in File._cache:
         response = MockHTTP()
         response.status = 200
         response.data = File._cache[url]
         response.headers = {'Content-Type': 'application/json'}
     else:
         response = get_mockdata_url("irws", "file", url, headers)
         File._cache[url] = response.data
     return response
예제 #5
0
    def getURL(self, url, headers):
        eos_host = getattr(settings, 'RESTCLIENTS_EOS_HOST', None)
        if eos_host:
            if EOS_DAO.pool is None:
                EOS_DAO.pool = get_con_pool(eos_host)

            return get_live_url(EOS_DAO.pool, 'GET', eos_host, url,
                                headers=headers, service_name='eos')

        return get_mockdata_url('eos', 'file', url, headers)
예제 #6
0
 def getURL(self, url, headers):
     return get_mockdata_url("pws", "file", url, headers)
예제 #7
0
 def getURL(self, url, headers):
     return get_mockdata_url("catalyst", "file", url, headers)
예제 #8
0
 def getURL(self, url, headers):
     #Removes expires_after tag in channel search requests
     if "v1/channel?" in url:
         url = re.sub('&expires_after=[^&]*', '', url)
     return get_mockdata_url("nws", "file", url, headers)
예제 #9
0
 def getURL(self, url, headers):
     return get_mockdata_url('kws', 'file', url, headers)
예제 #10
0
 def getURL(self, url, headers):
     return get_mockdata_url("digitlib", "file", url, headers)
예제 #11
0
 def getURL(self, url, headers):
     return get_mockdata_url("libraries", "file", url, headers)
예제 #12
0
 def getURL(self, url, headers):
     return get_mockdata_url("digitlib", "file", url, headers)
예제 #13
0
 def getURL(self, url, headers, subdomain):
     return get_mockdata_url("iasystem", subdomain, url, headers)
예제 #14
0
 def getURL(self, url, headers):
     return get_mockdata_url("libcurrics", "file", url, headers)
예제 #15
0
 def getURL(self, url, headers):
     return get_mockdata_url("calendar", "file", url, headers)
예제 #16
0
 def getURL(self, url, headers):
     # FileSea.logger.info("%s/file%s" % (self.get_path_prefix(), url))
     return get_mockdata_url(
         self.get_path_prefix(), "file",
         url, headers)
예제 #17
0
 def getURL(self, url, headers):
     return get_mockdata_url("uwnetid", "file", url, headers)
예제 #18
0
 def getURL(self, url, headers):
     return get_mockdata_url("hrpws", "file", url, headers)
예제 #19
0
 def getURL(self, url, headers):
     # Removes expires_after tag in channel search requests
     if "v1/channel?" in url:
         url = re.sub('&expires_after=[^&]*', '', url)
     return get_mockdata_url("nws", "file", url, headers)
예제 #20
0
 def getURL(self, url, headers):
     return get_mockdata_url("myplan", "file", url, headers)
예제 #21
0
 def getURL(self, url, headers, subdomain):
     return get_mockdata_url("iasystem", subdomain, url, headers)