Exemplo n.º 1
0
def post_a_new_picture_via_the_dedicated_resource(step):
    time.sleep(1)
    file = open("newebe/apps/pictures/tests/test.jpg", "r")

    (contentType, body) = encode_multipart_formdata([],
                            [("picture", "test.jpg", file.read())])
    headers = {'Content-Type': contentType}
    request = HTTPRequest(url=world.browser.root_url + "pictures/all/",
                          method="POST", body=body, headers=headers,
                          validate_cert=False)
    if hasattr(world.browser, "cookie"):
            request.headers["Cookie"] = world.browser.cookie
    world.browser.fetch(request)
Exemplo n.º 2
0
def post_a_new_picture_via_the_dedicated_resource(step):
    time.sleep(1)
    file = open("test.jpg", "r")
    
    (contentType, body) = encode_multipart_formdata([], 
                            [("picture", "test.jpg", file.read())])
    headers = {'Content-Type':contentType} 
    request = HTTPRequest(url=world.browser.root_url + "pictures/all/", 
                          method="POST", body=body, headers=headers,
                          validate_cert=False)
    if hasattr(world.browser, "cookie"):
            request.headers["Cookie"] = world.browser.cookie
    world.browser.fetch(request)
Exemplo n.º 3
0
def post_a_new_common_via_the_dedicated_resource(step):
    time.sleep(1)
    file = open(TEST_COMMON, "r")

    (contentType,
     body) = encode_multipart_formdata([],
                                       [("common", "vimqrc.pdf", file.read())])
    headers = {'Content-Type': contentType}
    request = HTTPRequest(url=world.browser.root_url + "commons/all/",
                          method="POST",
                          body=body,
                          headers=headers,
                          validate_cert=False)
    if hasattr(world.browser, "cookie"):
        request.headers["Cookie"] = world.browser.cookie
    world.browser.fetch(request)