tests.mock.response

Here are the examples of the python api tests.mock.response taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

7 Examples 7

Example 1

Project: python-fakturoid Source File: test_api.py
Function: test_load
    @patch('requests.get', return_value=response('account.json'))
    def test_load(self, mock):
        account = self.fa.account()

        self.assertEquals('https://app.fakturoid.cz/api/v2/accounts/myslug/account.json', mock.call_args[0][0])
        self.assertEquals("Alexandr Hejsek", account.name)
        self.assertEquals("[email protected]", account.email)

Example 2

Project: python-fakturoid Source File: test_api.py
Function: test_load
    @patch('requests.get', return_value=response('subject_28.json'))
    def test_load(self, mock):
        subject = self.fa.subject(28)

        self.assertEquals('https://app.fakturoid.cz/api/v2/accounts/myslug/subjects/28.json', mock.call_args[0][0])
        self.assertEquals(28, subject.id)
        self.assertEquals('47123737', subject.registration_no)
        self.assertEquals('2012-06-02T09:34:47+02:00', subject.updated_at.isoformat())

Example 3

Project: python-fakturoid Source File: test_api.py
Function: test_find
    @patch('requests.get', return_value=response('subjects.json'))
    def test_find(self, mock):
        subjects = self.fa.subjects()

        self.assertEquals('https://app.fakturoid.cz/api/v2/accounts/myslug/subjects.json', mock.call_args[0][0])
        self.assertEquals(2, len(subjects))
        self.assertEquals('Apple Czech s.r.o.', subjects[0].name)

Example 4

Project: python-fakturoid Source File: test_api.py
Function: test_load
    @patch('requests.get', return_value=response('invoice_9.json'))
    def test_load(self, mock):
        invoice = self.fa.invoice(9)

        self.assertEquals('https://app.fakturoid.cz/api/v2/accounts/myslug/invoices/9.json', mock.call_args[0][0])
        self.assertEquals('2012-0004', invoice.number)

Example 5

Project: python-fakturoid Source File: test_api.py
Function: test_load
    @patch('requests.get', return_value=response('generator_4.json'))
    def test_load(self, mock):
        g = self.fa.generator(4)

        self.assertEquals('https://app.fakturoid.cz/api/v2/accounts/myslug/generators/4.json', mock.call_args[0][0])
        self.assertEquals('Podpora', g.name)

Example 6

Project: python-fakturoid Source File: test_api.py
Function: test_find
    @patch('requests.get', return_value=response('generators.json'))
    def test_find(self, mock):
        generators = self.fa.generators()

        self.assertEquals('https://app.fakturoid.cz/api/v2/accounts/myslug/generators.json', mock.call_args[0][0])
        self.assertEquals(2, len(generators))

Example 7

Project: python-fakturoid Source File: test_api.py
Function: test_find
    @patch('requests.get', return_value=response('invoices.json'))
    def test_find(self, mock):
        invoice = self.fa.invoices()[:10]

        self.assertEquals('https://app.fakturoid.cz/api/v2/accounts/myslug/invoices.json', mock.call_args[0][0])