コード例 #1
0
def test_httpurl_md5_from_file(gcs_v6_txt_url, url_v6_txt, v6_txt_md5_hash):
    u_gcs_md5 = GCSURI(gcs_v6_txt_url + URIBase.MD5_FILE_EXT)
    if u_gcs_md5.exists:
        u_gcs_md5.rm()
    u_md5 = HTTPURL(url_v6_txt + URIBase.MD5_FILE_EXT)

    assert not u_gcs_md5.exists
    assert not u_md5.exists
    u = HTTPURL(url_v6_txt)
    assert u.md5_from_file is None

    u.get_metadata(make_md5_file=True)
    # HTTPURL should not make md5 file even with make_md5_file=True
    assert not u_md5.exists
    assert u.md5_from_file is None
コード例 #2
0
def test_httpurl_get_metadata(url_v6_txt, v6_txt_size, v6_txt_md5_hash):
    u = HTTPURL(url_v6_txt)

    m1 = u.get_metadata()
    assert m1.md5 == v6_txt_md5_hash
    assert m1.size == v6_txt_size

    m2 = u.get_metadata(skip_md5=True)
    assert m2.md5 is None
    assert m2.size == v6_txt_size

    u_md5 = HTTPURL(url_v6_txt + ".md5")
    if u_md5.exists:
        u_md5.rm()
    m3 = u.get_metadata(make_md5_file=True)
    assert m3.md5 == v6_txt_md5_hash
    assert m3.size == v6_txt_size
    # HTTPURL should not make md5 file even with make_md5_file=True
    assert not u_md5.exists