def test_1():
    page_test = hr.Html()
    hr.render_page(page_test, "test_1_html_class.htm")
    test_file = f"{tmp_directory}test_1_html_class.htm"
    hash_object_open = hashlib.md5()
    with open(test_file, 'rb') as afile:
        buf = afile.read()
        hash_object_open.update(buf)
    assert hash_object_open.hexdigest() == "94a82dd9d4d963d9be87a510eef281f6"
def test_0():
    page_test = hr.Element()
    page_test.append("Lorem ipsum dolor sit amet")
    hr.render_page(page_test, "test_0_render_class.htm")
    test_file = f"{tmp_directory}test_0_render_class.htm"
    hash_object_open = hashlib.md5()
    with open(test_file, 'rb') as afile:
        buf = afile.read()
        hash_object_open.update(buf)
    assert hash_object_open.hexdigest() == "b6d4bc719c12230e96a0d3e63ad30da7"
def test_3():
    page_test = hr.Html()
    body = hr.Body()
    page_test.append(body)
    hr.render_page(page_test, "test_3_body_class.htm")
    test_file = f"{tmp_directory}test_3_body_class.htm"
    hash_object_open = hashlib.md5()
    with open(test_file, 'rb') as afile:
        buf = afile.read()
        hash_object_open.update(buf)
    assert hash_object_open.hexdigest() == "27895e07b6faa150ae55ad2043947abe"
def test_4():
    page_test = hr.Html()
    body = hr.Body()
    body.append(hr.P("Lorem ipsum dolor sit amet", style="text-align: center; font-style: oblique;"))
    page_test.append(body)
    hr.render_page(page_test, "test_4_p_class.htm")
    test_file = f"{tmp_directory}test_4_p_class.htm"
    hash_object_open = hashlib.md5()
    with open(test_file, 'rb') as afile:
        buf = afile.read()
        hash_object_open.update(buf)
    assert hash_object_open.hexdigest() == "6aed2d9ebf983a50a4a444607b0bca93"
def test_6():
    page_test = hr.Html()
    body = hr.Body()
    body.append(hr.A("http://google.com", "google"))
    page_test.append(body)
    hr.render_page(page_test, "test_6_a_class.htm")
    test_file = f"{tmp_directory}test_6_a_class.htm"
    hash_object_open = hashlib.md5()
    with open(test_file, 'rb') as afile:
        buf = afile.read()
        hash_object_open.update(buf)
    assert hash_object_open.hexdigest() == "d174a8ea530d2ccfb72865019ea63646"
def test_5():
    page_test = hr.Html()
    body = hr.Body()
    body.append(hr.Hr())
    page_test.append(body)
    hr.render_page(page_test, "test_5_hr_class.htm")
    test_file = f"{tmp_directory}test_5_hr_class.htm"
    hash_object_open = hashlib.md5()
    with open(test_file, 'rb') as afile:
        buf = afile.read()
        hash_object_open.update(buf)
    assert hash_object_open.hexdigest() == "e19ef5bfaf2983b57fc6cbeeb6e55341"
def test_2():
    page_test = hr.Html()
    head = hr.Head()
    head.append(hr.Meta(charset="UTF-8"))
    head.append(hr.Title("Lorem ipsum dolor sit amet"))
    page_test.append(head)
    hr.render_page(page_test, "test_2_head_class.htm")
    test_file = f"{tmp_directory}test_2_head_class.htm"
    hash_object_open = hashlib.md5()
    with open(test_file, 'rb') as afile:
        buf = afile.read()
        hash_object_open.update(buf)
    assert hash_object_open.hexdigest() == "b362162f7599ff8217d0b5e8e5598849"
def test_7():
    page_test = hr.Html()
    body = hr.Body()
    list = hr.Ul(id="TheList", style="line-height:200%")
    list.append(hr.Li("The first item in a list"))
    list.append(hr.Li("This is the second item", style="color: red"))
    item = hr.Li()
    body.append(list)
    page_test.append(body)
    hr.render_page(page_test, "test_7_UILI_class.htm")
    test_file = f"{tmp_directory}test_7_UILI_class.htm"
    hash_object_open = hashlib.md5()
    with open(test_file, 'rb') as afile:
        buf = afile.read()
        hash_object_open.update(buf)
    assert hash_object_open.hexdigest() == "0f69f655f2b48ba2739fbdcab16cb612"
예제 #9
0
 def removeTask(input):
     taskList, output, body = renderFile().generate_base()
     body.append(render.H(1, "Remove Task: " + input.replace("-", " ")))
     body.append(render.Form("/task/" + input + "/remove"))
     body.append(render.Submit("Remove", input))
     body.append(render.A("/tasklist", "Cancel"))
     output.append(body)
     return render.render_page(output, "index.html")
예제 #10
0
 def updateTask(input):
     taskList, output, body = renderFile().generate_base()
     body.append(render.H(1, "Update Task: " + input.replace("-", " ")))
     body.append(render.Form("/tasklist/" + input.replace(
         "%20", " ") + "/update"))
     body.append(render.Input("update", input))
     body.append(render.Submit("Update", input))
     body.append(render.A("/tasklist", "Cancel"))
     output.append(body)
     return render.render_page(output, "index.html")
예제 #11
0
 def newTask():
     taskList, output, body = renderFile().generate_base()
     body.append(render.H(1, "Add New Task"))
     body.append(render.Form("/tasklist/new"))
     body.append(render.Input("task"))
     body.append(render.Br())
     body.append(render.Br())
     body.append(render.Submit("Add Task"))
     output.append(body)
     return render.render_page(output, "index.html")
예제 #12
0
 def homepage():
     taskList, output, body = renderFile().generate_base()
     body.append(render.H(1, "Task List"))
     body.append(render.A("/tasklist/new", "Add New Task"))
     unorderedList = render.Ul(id="unordered-task-list")
     for task in taskList:
         item = render.Li()
         item.append(task)
         item.append(
             render.A("/tasklist/"+(task).replace(" ", "-")+"/remove", "Delete"))
         item.append(
             render.A("/tasklist/"+(task).replace(" ", "-") + "/update", "Update"))
         item.append(render.Br())
         unorderedList.append(item)
     body.append(unorderedList)
     output.append(body)
     return render.render_page(output, "index.html")