Remove ThreadColor
Replaced with raw color values. In the future, we should probably investigate using "themes"
This commit is contained in:
@@ -35,7 +35,7 @@ def test_group_from_graphql(session):
|
||||
plan=None,
|
||||
participants={"1234", "2345", "3456"},
|
||||
nicknames={},
|
||||
color=None,
|
||||
color="#0084ff",
|
||||
emoji="😀",
|
||||
admins={"1234"},
|
||||
approval_mode=False,
|
||||
|
@@ -1,20 +1,19 @@
|
||||
import pytest
|
||||
import fbchat
|
||||
from fbchat import ThreadColor, ThreadABC, Thread
|
||||
from fbchat import ThreadABC, Thread
|
||||
|
||||
|
||||
def test_thread_color_from_graphql():
|
||||
assert None is ThreadColor._from_graphql(None)
|
||||
assert ThreadColor.MESSENGER_BLUE is ThreadColor._from_graphql("")
|
||||
assert ThreadColor.VIKING is ThreadColor._from_graphql("FF44BEC7")
|
||||
assert ThreadColor._from_graphql("DEADBEEF") is getattr(
|
||||
ThreadColor, "UNKNOWN_#ADBEEF"
|
||||
)
|
||||
def test_parse_color():
|
||||
assert "#0084ff" == ThreadABC._parse_color(None)
|
||||
assert "#0084ff" == ThreadABC._parse_color("")
|
||||
assert "#44bec7" == ThreadABC._parse_color("FF44BEC7")
|
||||
assert "#adbeef" == ThreadABC._parse_color("DEADBEEF")
|
||||
|
||||
|
||||
def test_thread_parse_customization_info_empty():
|
||||
assert {} == ThreadABC._parse_customization_info(None)
|
||||
assert {} == ThreadABC._parse_customization_info({"customization_info": None})
|
||||
default = {"color": "#0084ff", "emoji": None}
|
||||
assert default == ThreadABC._parse_customization_info(None)
|
||||
assert default == ThreadABC._parse_customization_info({"customization_info": None})
|
||||
|
||||
|
||||
def test_thread_parse_customization_info_group():
|
||||
@@ -34,7 +33,7 @@ def test_thread_parse_customization_info_group():
|
||||
}
|
||||
expected = {
|
||||
"emoji": "🎉",
|
||||
"color": ThreadColor.BRILLIANT_ROSE,
|
||||
"color": "#ff5ca1",
|
||||
"nicknames": {"123456789": "A", "987654321": "B"},
|
||||
}
|
||||
assert expected == ThreadABC._parse_customization_info(data)
|
||||
@@ -55,7 +54,7 @@ def test_thread_parse_customization_info_user():
|
||||
"thread_type": "ONE_TO_ONE",
|
||||
# ... Other irrelevant fields
|
||||
}
|
||||
expected = {"emoji": None, "color": None, "own_nickname": "A", "nickname": "B"}
|
||||
expected = {"emoji": None, "color": "#0084ff", "own_nickname": "A", "nickname": "B"}
|
||||
assert expected == ThreadABC._parse_customization_info(data)
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from fbchat import Message, FBchatFacebookError, TypingStatus, ThreadColor
|
||||
from fbchat import Message, FBchatFacebookError, TypingStatus
|
||||
from utils import random_hex, subset
|
||||
from os import path
|
||||
|
||||
@@ -91,14 +91,10 @@ def test_change_image_remote(client1, group, catch_event):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"color",
|
||||
[x for x in ThreadColor if x in [ThreadColor.MESSENGER_BLUE, ThreadColor.PUMPKIN]],
|
||||
)
|
||||
def test_change_color(client, catch_event, compare, color):
|
||||
def test_change_color(client, catch_event, compare):
|
||||
with catch_event("on_color_change") as x:
|
||||
client.change_thread_color(color)
|
||||
assert compare(x, new_color=color)
|
||||
client.change_thread_color("#44bec7")
|
||||
assert compare(x, new_color="#44bec7")
|
||||
|
||||
|
||||
@pytest.mark.xfail(raises=FBchatFacebookError, reason="Should fail, but doesn't")
|
||||
|
@@ -27,6 +27,7 @@ def test_user_from_graphql(session):
|
||||
is_friend=True,
|
||||
gender="female_singular",
|
||||
affinity=0.4560002,
|
||||
color="#0084ff",
|
||||
) == UserData._from_graphql(session, data)
|
||||
|
||||
|
||||
@@ -152,7 +153,7 @@ def test_user_from_thread_fetch(session):
|
||||
gender="female_singular",
|
||||
nickname="A",
|
||||
own_nickname="B",
|
||||
color=None,
|
||||
color="#0084ff",
|
||||
emoji=None,
|
||||
) == UserData._from_thread_fetch(session, data)
|
||||
|
||||
|
Reference in New Issue
Block a user