Esempio n. 1
0
    def setUp(self):
        super().setUp()
        self.login_as(self.user)

        self.external_id = "new-slack-id"
        self.channel_name = "my-channel"
        self.channel_id = "my-channel_id"
        self.response_url = "http://example.slack.com/response_url"

        self.integration = install_slack(self.organization)
        self.idp = add_identity(self.integration, self.user, self.external_id)

        responses.add(
            method=responses.POST,
            url=self.response_url,
            body='{"ok": true}',
            status=status.HTTP_200_OK,
            content_type="application/json",
        )
        responses.add(
            method=responses.POST,
            url="https://slack.com/api/chat.postMessage",
            body='{"ok": true}',
            status=status.HTTP_200_OK,
            content_type="application/json",
        )
Esempio n. 2
0
    def setUp(self):
        super().setUp()
        self.external_id = "slack:1"
        self.integration = install_slack(self.organization)
        self.idp = add_identity(self.integration, self.user, self.external_id)

        self.trigger_id = "13345224609.738474920.8088930838d88f008e0"
        self.response_url = (
            "https://hooks.slack.com/actions/T47563693/6204672533/x7ZLaiVMoECAW50Gw1ZYAXEM"
        )
Esempio n. 3
0
    def setUp(self):
        self.resp = responses.mock
        self.resp.__enter__()

        self.integration = install_slack(self.event.project.organization)
        self.add_list_response(
            "conversations",
            [
                {
                    "name": "my-channel",
                    "id": "m-c"
                },
                {
                    "name": "other-chann",
                    "id": "o-c"
                },
                {
                    "name": "my-private-channel",
                    "id": "m-p-c",
                    "is_private": True
                },
            ],
            result_name="channels",
        )
        self.add_list_response(
            "users",
            [
                {
                    "name": "first-morty",
                    "id": "m",
                    "profile": {
                        "display_name": "Morty"
                    }
                },
                {
                    "name": "other-user",
                    "id": "o-u",
                    "profile": {
                        "display_name": "Jimbob"
                    }
                },
                {
                    "name": "better_morty",
                    "id": "bm",
                    "profile": {
                        "display_name": "Morty"
                    }
                },
            ],
            result_name="members",
        )
Esempio n. 4
0
    def setUp(self):
        super().setUp()

        self.slack_id = "UXXXXXXX1"
        self.external_id = "new-slack-id"
        self.channel_name = "my-channel"
        self.channel_id = "my-channel_id"
        self.response_url = "http://example.slack.com/response_url"

        self.integration = install_slack(self.organization, self.external_id)
        self.idp = IdentityProvider.objects.create(
            type=EXTERNAL_PROVIDERS[ExternalProviders.SLACK],
            external_id=self.external_id,
            config={},
        )
        self.login_as(self.user)
Esempio n. 5
0
    def setUp(self):
        self.integration = install_slack(self.organization)
        self.uuid = uuid4().hex

        channels = {
            "ok": "true",
            "channels": [{
                "name": "my-channel",
                "id": "chan-id"
            }]
        }

        responses.add(
            method=responses.GET,
            url="https://slack.com/api/conversations.list",
            status=200,
            content_type="application/json",
            body=json.dumps(channels),
        )
Esempio n. 6
0
    def setUp(self):
        super().setUp()
        self.integration = install_slack(self.organization)

        self.request = RequestFactory().get("slack/event")
Esempio n. 7
0
 def setUp(self):
     super().setUp()
     self.integration = install_slack(self.organization)
 def setUp(self):
     self.integration = install_slack(self.get_event().project.organization)