Ejemplo n.º 1
0
    async def message_unpinned(self, event, channel):
        """Send an UnpinMessage event."""

        return events.UnpinMessage(
            linked_event=event["item"],
            target=event["channel_id"],
            connector=self.connector,
            event_id=event["event_ts"],
            raw_event=event,
        )
Ejemplo n.º 2
0
 async def message_unpinned(self, event, channel):
     """Send an UnpinMessage event."""
     # Note that the pin_removed event in slack doesn't have a "channel" keyword.
     return events.UnpinMessage(
         linked_event=event["item"],
         target=event["channel_id"],
         connector=self.connector,
         event_id=event["event_ts"],
         raw_event=event,
     )
Ejemplo n.º 3
0
async def test_send_pin_removed(send_event, connector):
    message = events.Message(
        "An important message",
        user="******",
        user_id="U9S8JGF45",
        target="an-existing-room",
        connector=connector,
        event_id="1582838099.000600",
    )

    event = events.UnpinMessage(target="room", linked_event=message)

    payload, response = await send_event(PINS_REMOVE, event)
    assert payload == {"channel": "room", "timestamp": "1582838099.000600"}
    assert response["ok"]
Ejemplo n.º 4
0
 async def test_send_pin_removed(self):
     connector = ConnectorSlack({"token": "abc123"}, opsdroid=self.od)
     connector.slack.api_call = amock.CoroutineMock()
     await connector.send(
         events.UnpinMessage(
             target="an-existing-room",
             linked_event=events.Message(
                 "An important message",
                 user="******",
                 user_id="U9S8JGF45",
                 target="an-existing-room",
                 connector=connector,
                 event_id="1582838099.000600",
             ),
         ))
     connector.slack.api_call.assert_called_once_with(
         "pins.remove",
         data={
             "channel": "an-existing-room",
             "timestamp": "1582838099.000600"
         },
     )