Beispiel #1
0
    def submit_ticket(self):
        """Submit the ticket to Zendesk."""
        if self.user.is_authenticated():
            email = self.user.email
        else:
            email = self.cleaned_data["email"]

        submit_ticket(email, self.cleaned_data["category"], self.cleaned_data["subject"], self.ticket_body(email), [])
Beispiel #2
0
    def submit_ticket(self):
        """Submit the ticket to Zendesk."""
        if self.user.is_authenticated():
            email = self.user.email
        else:
            email = self.cleaned_data['email']

        submit_ticket(email, self.cleaned_data['category'],
                      self.cleaned_data['subject'], self.ticket_body, [])
Beispiel #3
0
    def submit_ticket(self):
        """Submit the ticket to Zendesk."""
        if self.user.is_authenticated():
            email = self.user.email
        else:
            email = self.cleaned_data['email']

        submit_ticket(
            email,
            self.cleaned_data['category'],
            self.cleaned_data['subject'],
            self.ticket_body)
Beispiel #4
0
    def submit_ticket(self):
        """Submit the ticket to Zendesk."""
        if self.user.is_authenticated():
            email = self.user.email
        else:
            email = self.cleaned_data["email"]

        submit_ticket(
            email,
            self.cleaned_data["category"],
            self.cleaned_data["subject"],
            self.ticket_body(email),
            [],
        )
Beispiel #5
0
def escalate_question(question_id):
    """Escalate a question to zendesk by submitting a ticket."""
    from kitsune.questions.models import Question
    question = Question.objects.get(id=question_id)

    url = 'https://{domain}{url}'.format(
        domain=Site.objects.get_current().domain,
        url=question.get_absolute_url())

    submit_ticket(
        email='*****@*****.**',
        category='Escalated',
        subject=u'[Escalated] {title}'.format(title=question.title),
        body=u'{url}\n\n{content}'.format(url=url, content=question.content))
Beispiel #6
0
    def test_submit_ticket(self, get_zendesk):
        """Verify the http calls that are triggered by submit_ticket"""
        zd = FauxZendesk("https://appsmarket.zendesk.com", "[email protected]", "pwd")
        get_zendesk.return_value = zd

        submit_ticket("[email protected]", "cat", "subject", "description")
        zd.client.request.assert_called_with(
            "https://appsmarket.zendesk.com/tickets.json?",
            "POST",
            body='{"ticket": {"requester_email": "[email protected]", "set_tags": "cat", '
            '"description": "description", '
            '"subject": "[TEST] subject"}}',
            headers={"Content-Type": "application/json", "User-agent": "Zendesk Python Library v1.1.0"},
        )
Beispiel #7
0
    def test_submit_ticket(self, get_zendesk):
        """Verify the http calls that are triggered by submit_ticket"""
        zd = FauxZendesk('https://appsmarket.zendesk.com', '[email protected]', 'pwd')
        get_zendesk.return_value = zd

        submit_ticket('[email protected]', 'cat', 'subject', 'description')
        zd.client.request.assert_called_with(
            'https://appsmarket.zendesk.com/tickets.json?',
            'POST',
            body='{"ticket": {"requester_email": "[email protected]", "set_tags": "cat", '
                 '"description": "description", '
                 '"subject": "[TEST] subject"}}',
            headers={
                'Content-Type': 'application/json',
                'User-agent': 'Zendesk Python Library v1.1.1'})
Beispiel #8
0
    def test_submit_ticket(self, get_zendesk):
        """Verify the http calls that are triggered by submit_ticket"""
        zd = FauxZendesk('https://appsmarket.zendesk.com', '[email protected]', 'pwd')
        get_zendesk.return_value = zd

        submit_ticket('[email protected]', 'cat', 'subject', 'description')
        zd.client.request.assert_called_with(
            'https://appsmarket.zendesk.com/tickets.json?',
            'POST',
            body='{"ticket": {"requester_email": "[email protected]", "set_tags": "cat", '
            '"description": "description", '
            '"subject": "[TEST] subject"}}',
            headers={
                'Content-Type': 'application/json',
                'User-agent': 'Zendesk Python Library v1.1.1'
            })
Beispiel #9
0
def escalate_question(question_id):
    """Escalate a question to zendesk by submitting a ticket."""
    from kitsune.questions.models import Question
    question = Question.objects.get(id=question_id)

    url = 'https://{domain}{url}'.format(
        domain=Site.objects.get_current().domain,
        url=question.get_absolute_url())

    try:
        submit_ticket(
            email='*****@*****.**',
            category='Escalated',
            subject=u'[Escalated] {title}'.format(title=question.title),
            body=u'{url}\n\n{content}'.format(url=url, content=question.content))
    except ZendeskError:
        # This is unpickleable, so we need to unwrap it a bit
        raise PickleableZendeskError()
Beispiel #10
0
def escalate_question(question_id):
    """Escalate a question to zendesk by submitting a ticket."""
    from kitsune.questions.models import Question
    question = Question.objects.get(id=question_id)

    url = 'https://{domain}{url}'.format(
        domain=Site.objects.get_current().domain,
        url=question.get_absolute_url())

    try:
        submit_ticket(
            email='*****@*****.**',
            category='Escalated',
            subject=u'[Escalated] {title}'.format(title=question.title),
            body=u'{url}\n\n{content}'.format(url=url,
                                              content=question.content))
    except ZendeskError:
        # This is unpickleable, so we need to unwrap it a bit
        raise PickleableZendeskError()