Beispiel #1
0
def H(ctype, *hpairs):
    n = datetime.datetime.now()
    msg = MockHTTPMessage([("x-amz-request-id", "abcdef"),
                           ("x-amz-id-2", "foobar"), ("Server", "AmazonS3"),
                           ("Date", rfc822_fmtdate(n))])
    msg["Content-Type"] = ctype
    for h, v in hpairs:
        msg[h] = v
    return msg
Beispiel #2
0
 def test_get(self):
     dt = datetime.datetime(1990, 1, 31, 12, 34, 56)
     headers = g.H("text/plain", ("date", rfc822_fmtdate(dt)),
                   ("x-amz-meta-foo", "bar"))
     g.bucket.add_resp("/foo.txt", headers, "ohi")
     fp = g.bucket["foo.txt"]
     eq_(fp.oss_info["mimetype"], "text/plain")
     eq_(fp.oss_info["metadata"], {"foo": "bar"})
     eq_(fp.oss_info["date"], dt)
     eq_(fp.read().decode("ascii"), "ohi")
Beispiel #3
0
 def test_get(self):
     dt = datetime.datetime(1990, 1, 31, 12, 34, 56)
     headers = g.H("text/plain",
         ("date", rfc822_fmtdate(dt)),
         ("x-amz-meta-foo", "bar"))
     g.bucket.add_resp("/foo.txt", headers, "ohi")
     fp = g.bucket["foo.txt"]
     eq_(fp.oss_info["mimetype"], "text/plain")
     eq_(fp.oss_info["metadata"], {"foo": "bar"})
     eq_(fp.oss_info["date"], dt)
     eq_(fp.read().decode("ascii"), "ohi")
Beispiel #4
0
def H(ctype, *hpairs):
    n = datetime.datetime.now()
    msg = MockHTTPMessage([
        ("x-amz-request-id", "abcdef"),
        ("x-amz-id-2", "foobar"),
        ("Server", "AmazonS3"),
        ("Date", rfc822_fmtdate(n))])
    msg["Content-Type"] = ctype
    for h, v in hpairs:
        msg[h] = v
    return msg
Beispiel #5
0
def test_rfc822():
    s = rfc822_fmtdate()
    dt = rfc822_parsedate(s)
    eq_(s, rfc822_fmtdate(dt))
    eq_(dt, rfc822_parsedate(s))
Beispiel #6
0
def test_rfc822():
    s = rfc822_fmtdate()
    dt = rfc822_parsedate(s)
    eq_(s, rfc822_fmtdate(dt))
    eq_(dt, rfc822_parsedate(s))