summaryrefslogtreecommitdiff
path: root/service/test/integration/test_feedback_service.py
blob: ff6593965b26baf0bfe879ee369adc38ae2b6c8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from twisted.trial import unittest
from httmock import urlmatch, HTTMock
from mockito import when
from twisted.internet import defer
from test.support.integration import AppTestClient


@urlmatch(netloc=r'some.leap-provider.tld$')
def google_mock(url, request):
    return 'Pixelated is awesome!'


class TestFeedbackService(unittest.TestCase, AppTestClient):

    @defer.inlineCallbacks
    def test_open_ticket(self):
        with HTTMock(google_mock):
            yield self.start_client()
            self.feedback_service.FEEDBACK_URL = "https://some.leap-provider.tld/tickets"
            when(self.leap_session).account_email().thenReturn("text@pixelated-project.org")
            response = self.feedback_service.open_ticket("Pixelated is awesome!")

            self.assertEquals(response.status_code, 200)