コード例 #1
0
def test_sha1():
    from hashlib import sha1
    a = Attachment("foobar")
    content = "Hello WOrld, this Is some Fabcy file content."
    a.content = content
    sha1 = sha1(content).hexdigest()
    assert sha1 == a.sha1
コード例 #2
0
def test_sha1():
    from hashlib import sha1
    a = Attachment("foobar")
    content = "Hello WOrld, this Is some Fabcy file content."
    a.content = content
    sha1 = sha1(content).hexdigest()
    assert sha1 == a.sha1
コード例 #3
0
def test_named_args():
    a = Attachment(identifier="foobar",
                   name="Some Attachment",
                   mimetype="application/pdf",
                   filename="SomeAttachment.pdf",
                   size=123456,
                   sha1="439873428369057jsdfkjsh983239873523kj",
                   content="\r\nThis is some messy content\r\n",
                   thumbnails=[])
    assert type(a) == Attachment
    assert a.size == 123456
コード例 #4
0
def test_dict():
    a = Attachment("foobar")
    d = a.dict()
    assert type(d) == dict
コード例 #5
0
def test_identifier_filter():
    a = Attachment("blahblub 1234")
    assert hasattr(a, "identifier")
    a.apply_filters()
    assert a.identifier == "blahblub1234"
コード例 #6
0
def test_dict():
    a = Attachment("foobar")
    d = a.dict()
    assert type(d) == dict
コード例 #7
0
def test_identifier_filter():
    a = Attachment("blahblub 1234")
    assert hasattr(a, "identifier")
    a.apply_filters()
    assert a.identifier == "blahblub1234"
コード例 #8
0
def test_unnamed_args():
    a = Attachment("blahblub1234")
    assert hasattr(a, "identifier")
    assert a.identifier == "blahblub1234"
コード例 #9
0
def test_param_timestamp():
    lm = datetime.datetime(2012, 1, 1, 12, 0, 0)
    a = Attachment("blahblub1234", last_modified=lm)
    assert a.last_modified == lm
コード例 #10
0
def test_default_timestamp():
    a = Attachment("blahblub1234")
    assert hasattr(a, 'last_modified')
    assert getattr(a, 'last_modified') is not None
    assert a.last_modified is not None
    assert type(a.last_modified) == type(datetime.datetime.utcnow())
コード例 #11
0
def test_basic_attachment():
    a = Attachment("foo")
    assert type(a) == Attachment