Ejemplo n.º 1
0
def create_test_token_file():
    with open(CO.AccessData.ACCESS_TOKEN_FILE, 'w') as fp:
        fp.write(
"""{{
    "access_token": "{access_token}", 
    "creation_time": "{time_now}", 
    "message": "created for Python unit tests", 
    "user_id": "{user_id}"
}}
""".format(access_token=TEST_ACCESS_TOKEN, time_now=CO.time_now(), user_id=TEST_USER_ID))
Ejemplo n.º 2
0
    def send_html_content(self, page_body):
        """
        Send HTML including the given page body to the browser
        @type page_body: string
        @param page_body: page body to send back to the browser (do not include C{<html>} or C{<body>} tags)
        """
        content="""<html>
<head><title>BCS SPA 2014 OAuth Demo</title></head>
<body>{body}<p><i>{time_now}</i></p></body>
</html>""".format(body=page_body, time_now=CO.time_now())
        self.wfile.write(content)
Ejemplo n.º 3
0
 def __init__(self, http_status, message='', redirect_url=''):
     """
     @type http_status: int
     @param http_status: the HTTP status code (eg 200 for success)
     @type message: string
     @param message: an information message
     @type redirect_url: string
     @param redirect_url: optional parameter containing a redirection URL
     """
     self.http_status = http_status
     """the HTTP status code (eg 200 for success)"""
     self.message = message
     """an information message"""
     self.redirect_url = redirect_url
     """optional parameter containing a redirection URL"""
     self.time_now = CO.time_now()
     """set to the time the object was created"""
Ejemplo n.º 4
0
 def __init__(self, http_status, message='', redirect_url=''):
     """
     @type http_status: int
     @param http_status: the HTTP status code (eg 200 for success)
     @type message: string
     @param message: an information message
     @type redirect_url: string
     @param redirect_url: optional parameter containing a redirection URL
     """
     self.http_status = http_status
     """the HTTP status code (eg 200 for success)"""
     self.message = message
     """an information message"""
     self.redirect_url = redirect_url
     """optional parameter containing a redirection URL"""
     self.time_now = CO.time_now()
     """set to the time the object was created"""