Beispiel #1
0
    def test_issue_modify(self, slackmock):
        issue = Issue()
        issue.title = self.title_name
        issue.project = self.project
        issue.save()

        self.selenium.get(
                '{}{}'.format(
                    self.live_server_url,
                    reverse('issue:edit', kwargs={'project': self.short, 'sqn_i': issue.number})
                    )
                )
        f = self.selenium.find_element_by_css_selector("input.select2-search__field").click()
        time.sleep(1)
        self.selenium.find_elements_by_css_selector('#select2-id_assignee-results li')[0].click()
        self.selenium.find_element_by_id('id_submit_edit').click()
        slackmock().api_call.assert_called_with(
            "chat.postMessage",
            channel="channel",
            attachments=[{
                'fallback': str(self.user) + " changed issue "+self.short+"-1 "+self.title_name+".",
                'pretext': 'Issue changed:',
                'title': self.short+"-1 "+self.title_name,
                'title_link': "http://localhost:8000/project/"+self.short+"/issue/1/",
                'author_name': str(self.user),
                'author_link': "http://localhost:8000" + self.user.get_absolute_url(),
                'author_icon': "http://localhost:8000" + self.user.avatar.url,
                'fields': [{
                    'title': 'Assignee',
                    'value': ' → a',
                    'short': True,
                    }],
                'color': 'good',
            }]
        )
Beispiel #2
0
    def test_comment(self, slackmock):
        issue = Issue()
        issue.title = self.title_name
        issue.project = self.project
        issue.save()

        self.selenium.get(
                '{}{}'.format(
                    self.live_server_url,
                    reverse('issue:detail', kwargs={'project': self.project.name_short, 'sqn_i': issue.number})
                    )
                )
        f = self.selenium.find_element_by_id("id_text")
        f.send_keys(self.comment)
        self.selenium.find_element_by_name("action").click()
        slackmock().api_call.assert_called_with(
            "chat.postMessage",
            channel="channel",
            attachments=[{
                'fallback': str(self.user) + ' commented on \"'+self.short+'-1 '+self.title_name+'\".',
                'pretext': 'New comment:',
                'text': self.comment,
                'title': self.short+"-1 "+self.title_name,
                'title_link': "http://localhost:8000/project/"+self.short+"/issue/1/",
                'author_name': str(self.user),
                'author_link': "http://localhost:8000" + self.user.get_absolute_url(),
                'author_icon': "http://localhost:8000" + self.user.avatar.url,
                'color': 'good',
            }]
        )
Beispiel #3
0
    def test_issue_modify(self, slackmock):
        issue = Issue()
        issue.title = self.title_name
        issue.project = self.project
        issue.save()

        self.selenium.get('{}{}'.format(
            self.live_server_url,
            reverse('issue:edit',
                    kwargs={
                        'project': self.short,
                        'sqn_i': issue.number
                    })))

        # open assignee autocomplete field
        self.selenium.find_element(By.CSS_SELECTOR,
                                   "input.select2-search__field").click()
        # select first result
        self.selenium.find_elements(
            By.CSS_SELECTOR, '#select2-id_assignee-results li')[0].click()
        # close autocomplete
        self.selenium.find_element(By.CSS_SELECTOR,
                                   "input.select2-search__field").send_keys(
                                       Keys.ESCAPE)

        self.selenium.find_element(By.ID, 'id_submit_edit').click()
        slackmock.chat_postMessage.assert_called_with(
            channel="channel",
            attachments=[{
                'fallback':
                str(self.user) + " changed issue " + self.short + "-1 " +
                self.title_name + ".",
                'pretext':
                'Issue changed:',
                'title':
                self.short + "-1 " + self.title_name,
                'title_link':
                "http://localhost:8000/project/" + self.short + "/issue/1/",
                'author_name':
                str(self.user),
                'author_link':
                "http://localhost:8000" + self.user.get_absolute_url(),
                'author_icon':
                "http://localhost:8000" + self.user.avatar.url,
                'fields': [{
                    'title': 'Assignee',
                    'value': ' → a',
                    'short': True,
                }],
                'color':
                'good',
            }])