Combine variously sized previews to a single key
This commit is contained in:
@@ -447,11 +447,13 @@ def test_share_with_video_subattachment():
|
||||
uid="2222",
|
||||
duration=datetime.timedelta(seconds=24, microseconds=469000),
|
||||
preview_url="https://video-arn2-1.xx.fbcdn.net/v/t42.9040-2/vid.mp4",
|
||||
medium_image=fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/t15.5256-10/p180x540/1.jpg",
|
||||
width=960,
|
||||
height=540,
|
||||
),
|
||||
previews={
|
||||
fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/t15.5256-10/p180x540/1.jpg",
|
||||
width=960,
|
||||
height=540,
|
||||
)
|
||||
},
|
||||
)
|
||||
],
|
||||
uid="deadbeef123",
|
||||
|
@@ -33,17 +33,19 @@ def test_imageattachment_from_list():
|
||||
uid="1234",
|
||||
width=2833,
|
||||
height=1367,
|
||||
thumbnail=fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/s261x260/1.jpg"
|
||||
),
|
||||
preview=fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/2.jpg", width=960, height=463
|
||||
),
|
||||
large_preview=fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/s2048x2048/3.jpg",
|
||||
width=2048,
|
||||
height=988,
|
||||
),
|
||||
previews={
|
||||
fbchat.Image(url="https://scontent-arn2-1.xx.fbcdn.net/v/s261x260/1.jpg"),
|
||||
fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/2.jpg",
|
||||
width=960,
|
||||
height=463,
|
||||
),
|
||||
fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/s2048x2048/3.jpg",
|
||||
width=2048,
|
||||
height=988,
|
||||
),
|
||||
},
|
||||
) == ImageAttachment._from_list({"node": data})
|
||||
|
||||
|
||||
@@ -71,19 +73,21 @@ def test_videoattachment_from_list():
|
||||
uid="1234",
|
||||
width=640,
|
||||
height=368,
|
||||
small_image=fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/t15.3394-10/p261x260/1.jpg"
|
||||
),
|
||||
medium_image=fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/t15.3394-10/2.jpg",
|
||||
width=640,
|
||||
height=368,
|
||||
),
|
||||
large_image=fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/t15.3394-10/3.jpg",
|
||||
width=640,
|
||||
height=368,
|
||||
),
|
||||
previews={
|
||||
fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/t15.3394-10/p261x260/1.jpg"
|
||||
),
|
||||
fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/t15.3394-10/2.jpg",
|
||||
width=640,
|
||||
height=368,
|
||||
),
|
||||
fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/t15.3394-10/3.jpg",
|
||||
width=640,
|
||||
height=368,
|
||||
),
|
||||
},
|
||||
) == VideoAttachment._from_list({"node": data})
|
||||
|
||||
|
||||
@@ -152,11 +156,11 @@ def test_graphql_to_attachment_image1():
|
||||
"width": 128,
|
||||
},
|
||||
"large_preview": {
|
||||
"uri": "https://scontent-arn2-1.xx.fbcdn.net/v/2.png",
|
||||
"uri": "https://scontent-arn2-1.xx.fbcdn.net/v/1.png",
|
||||
"height": 128,
|
||||
"width": 128,
|
||||
},
|
||||
"thumbnail": {"uri": "https://scontent-arn2-1.xx.fbcdn.net/v/p50x50/3.png"},
|
||||
"thumbnail": {"uri": "https://scontent-arn2-1.xx.fbcdn.net/v/p50x50/2.png"},
|
||||
"photo_encodings": [],
|
||||
"legacy_attachment_id": "1234",
|
||||
"original_dimensions": {"x": 128, "y": 128},
|
||||
@@ -170,15 +174,14 @@ def test_graphql_to_attachment_image1():
|
||||
width=None,
|
||||
height=None,
|
||||
is_animated=False,
|
||||
thumbnail=fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/p50x50/3.png"
|
||||
),
|
||||
preview=fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/1.png", width=128, height=128
|
||||
),
|
||||
large_preview=fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/2.png", width=128, height=128
|
||||
),
|
||||
previews={
|
||||
fbchat.Image(url="https://scontent-arn2-1.xx.fbcdn.net/v/p50x50/2.png"),
|
||||
fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/1.png",
|
||||
width=128,
|
||||
height=128,
|
||||
),
|
||||
},
|
||||
) == graphql_to_attachment(data)
|
||||
|
||||
|
||||
@@ -207,12 +210,9 @@ def test_graphql_to_attachment_image2():
|
||||
width=None,
|
||||
height=None,
|
||||
is_animated=True,
|
||||
preview=fbchat.Image(
|
||||
url="https://cdn.fbsbx.com/v/1.gif", width=128, height=128
|
||||
),
|
||||
animated_preview=fbchat.Image(
|
||||
url="https://cdn.fbsbx.com/v/1.gif", width=128, height=128
|
||||
),
|
||||
previews={
|
||||
fbchat.Image(url="https://cdn.fbsbx.com/v/1.gif", width=128, height=128)
|
||||
},
|
||||
) == graphql_to_attachment(data)
|
||||
|
||||
|
||||
@@ -249,19 +249,23 @@ def test_graphql_to_attachment_video():
|
||||
height=None,
|
||||
duration=datetime.timedelta(seconds=6),
|
||||
preview_url="https://video-arn2-1.xx.fbcdn.net/v/video-4321.mp4",
|
||||
small_image=fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/s168x128/1.jpg",
|
||||
width=168,
|
||||
height=96,
|
||||
),
|
||||
medium_image=fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/p261x260/3.jpg",
|
||||
width=452,
|
||||
height=260,
|
||||
),
|
||||
large_image=fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/2.jpg", width=640, height=368
|
||||
),
|
||||
previews={
|
||||
fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/s168x128/1.jpg",
|
||||
width=168,
|
||||
height=96,
|
||||
),
|
||||
fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/p261x260/3.jpg",
|
||||
width=452,
|
||||
height=260,
|
||||
),
|
||||
fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/2.jpg",
|
||||
width=640,
|
||||
height=368,
|
||||
),
|
||||
},
|
||||
) == graphql_to_attachment(data)
|
||||
|
||||
|
||||
@@ -346,9 +350,11 @@ def test_graphql_to_subattachment_video():
|
||||
uid="1234",
|
||||
duration=datetime.timedelta(seconds=24, microseconds=469000),
|
||||
preview_url="https://video-arn2-1.xx.fbcdn.net/v/t42.9040-2/vid.mp4",
|
||||
medium_image=fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/t15.5256-10/p180x540/1.jpg",
|
||||
width=960,
|
||||
height=540,
|
||||
),
|
||||
previews={
|
||||
fbchat.Image(
|
||||
url="https://scontent-arn2-1.xx.fbcdn.net/v/t15.5256-10/p180x540/1.jpg",
|
||||
width=960,
|
||||
height=540,
|
||||
)
|
||||
},
|
||||
) == graphql_to_subattachment(data)
|
||||
|
Reference in New Issue
Block a user