예제 #1
0
def test_payment(fixture_path):
    with open(f'{fixture_path}/payment.json') as json_file:
        data = json.load(json_file)

    event = KbEvent.from_dict(data)

    assert event.type == EventType.WALLET
    assert event.source == Source.PAYMENT
    assert event.notification.amountDescription == '12.3400000 XLM'
    assert event.notification.statusDescription == PaymentStatusStr.COMPLETED
예제 #2
0
def test_reaction(fixture_path):
    with open(f'{fixture_path}/reaction.json') as json_file:
        data = json.load(json_file)

    event = KbEvent.from_dict(data)

    assert event.msg.content.type == ContentType.REACTION
    assert event.msg.content.reaction.b == ':sunglasses:'
    reply_channel = event.msg.channel.replyable_dict()
    assert reply_channel == {'name': 'someoneelse,yourbot'}
예제 #3
0
def test_oneonone(fixture_path):
    with open(f'{fixture_path}/oneonone.json') as json_file:
        data = json.load(json_file)

    event = KbEvent.from_dict(data)

    assert event.type == EventType.CHAT
    assert event.msg.content.text.body == "hi"
    reply_channel = event.msg.channel.replyable_dict()
    assert reply_channel == {'name': 'someoneelse,yourbot'}
예제 #4
0
def test_payment(fixture_path):
    with open(f"{fixture_path}/payment.json") as json_file:
        data = json.load(json_file)

    event = KbEvent.from_dict(data)

    assert event.type == EventType.WALLET
    assert event.source == Source.PAYMENT_STATUS
    assert event.notification.summary.amount_description == "1 XLM"
    assert (event.notification.summary.status_description ==
            stellar1.PaymentStatusStrings.PENDING.value)
예제 #5
0
def test_teamchat(fixture_path):
    with open(f'{fixture_path}/teamchat.json') as json_file:
        data = json.load(json_file)

    event = KbEvent.from_dict(data)

    assert event.type == EventType.CHAT
    expected_team_mention = TeamMention(name='yourcompany.marketing', channel='general')
    assert event.msg.content.text.teamMentions == [expected_team_mention]
    reply_channel = event.msg.channel.replyable_dict()
    assert reply_channel == {'name': 'yourcompany.marketing', 'topic_name': 'lunchtalk', 'members_type': 'team'}
예제 #6
0
def test_chat_conv(fixture_path):
    with open(f"{fixture_path}/chat_conv.json") as json_file:
        data = json.load(json_file)

    event = KbEvent.from_dict(data)
    assert event.type == EventType.CHAT_CONV
    assert not event.conv.unread
    assert event.conv.creator_info.username == "yourbot"
    channel = event.conv.channel.to_dict()
    assert channel == {
        "name": "yourcompany.marketing",
        "topic_name": "general",
        "members_type": "team",
        "topic_type": "chat",
        "public": None,
    }
예제 #7
0
def test_reaction(fixture_path):
    with open(f"{fixture_path}/reaction.json") as json_file:
        data = json.load(json_file)

    event = KbEvent.from_dict(data)

    assert event.msg.content.type_name == chat1.MessageTypeStrings.REACTION.value
    assert event.msg.content.reaction.body == ":sunglasses:"
    reply_channel = event.msg.channel.to_dict()
    assert reply_channel == {
        "name": "someoneelse,yourbot",
        "members_type": "impteamnative",
        "public": False,
        "topic_name": None,
        "topic_type": "chat",
    }
예제 #8
0
def test_oneonone(fixture_path):
    with open(f"{fixture_path}/oneonone.json") as json_file:
        data = json.load(json_file)

    event = KbEvent.from_dict(data)

    assert event.type == EventType.CHAT
    assert event.msg.content.text.body == "hi"
    reply_channel = event.msg.channel.to_dict()
    assert reply_channel == {
        "name": "someoneelse,yourbot",
        "members_type": "impteamnative",
        "public": False,
        "topic_name": None,
        "topic_type": "chat",
    }
예제 #9
0
def test_teamchat(fixture_path):
    with open(f"{fixture_path}/teamchat.json") as json_file:
        data = json.load(json_file)

    event = KbEvent.from_dict(data)

    assert event.type == EventType.CHAT
    expected_team_mention = chat1.KnownTeamMention(
        name="yourcompany.marketing", channel="general")
    assert event.msg.content.text.team_mentions == [expected_team_mention]
    reply_channel = event.msg.channel.to_dict()
    assert reply_channel == {
        "name": "yourcompany.marketing",
        "topic_name": "lunchtalk",
        "members_type": "team",
        "topic_type": "chat",
        "public": False,
    }