def test_uninstallation(self):
        model = Integration.objects.create(
            provider="slack",
            external_id="some_slack",
            name="Test Slack",
            metadata={
                "domain_name": "slack-test.slack.com",
                "installation_type": "born_as_bot",
                "access_token": "xoxp-xxxxxxxxx-xxxxxxxxxx-xxxxxxxxxxxx",
            },
        )

        model.add_organization(self.organization, self.user)
        self.load_page("slack", configuration_tab=True)
        self.browser.snapshot(name="integrations - integration detail one configuration")

        detail_view_page = OrganizationIntegrationDetailViewPage(browser=self.browser)
        assert self.browser.element_exists('[aria-label="Configure"]')
        detail_view_page.uninstall()

        assert (
            self.browser.element('[data-test-id="integration-status"]').text == "Pending Deletion"
        )
        self.browser.snapshot(name="integrations - integration detail no configurations")
Exemplo n.º 2
0
    def test_example_installation(self):
        self.provider = mock.Mock()
        self.provider.key = "example"
        self.provider.name = "Example Installation"

        self.load_page("example")
        self.browser.snapshot("integrations - integration detail overview")

        detail_view_page = OrganizationIntegrationDetailViewPage(
            browser=self.browser)
        detail_view_page.click_install_button()
        detail_view_page.click_through_integration_setup(
            ExampleIntegrationSetupWindowElement, {"name": self.provider.name})

        # provider_element might be rerendered
        assert Integration.objects.filter(
            provider=self.provider.key,
            external_id=self.provider.name).exists()

        detail_view_page.switch_to_configuration_view()
        assert self.browser.element_exists('[aria-label="Configure"]')
    def test_example_installation(self):
        self.provider = mock.Mock()
        self.provider.key = "alert_rule_integration"
        self.provider.name = "Example Installation"

        self.load_page("alert_rule_integration")
        self.browser.snapshot("integrations - integration detail overview")

        detail_view_page = OrganizationIntegrationDetailViewPage(
            browser=self.browser)
        detail_view_page.click_install_button()
        detail_view_page.click_through_integration_setup(
            ExampleIntegrationSetupWindowElement, {"name": self.provider.name})

        integration = Integration.objects.filter(
            provider=self.provider.key,
            external_id=self.provider.name).first()

        assert integration
        assert (
            f"/settings/{self.organization.slug}/integrations/{self.provider.key}/{integration.id}/"
            in self.browser.driver.current_url)