GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#22)
by samuel
52s
created

paystackapi.tests.TestHttpMethods   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %
Metric Value
dl 0
loc 52
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A test_get_method_called() 0 14 1
A setUp() 0 2 1
A test_put_method_called() 0 15 1
A test_post_method_called() 0 15 1
1
"""Script defined to test the Class instance."""
2
3
4
import unittest
5
import httpretty
6
7
from paystackapi.base import PayStackBase, PayStackRequests
8
9
10
class TestHttpMethods(unittest.TestCase):
11
    """Method defined to test transaction instance."""
12
13
    def setUp(self):
14
        paystackbase = PayStackBase()
15
16
    @httpretty.activate
17
    def test_get_method_called(self):
18
19
        httpretty.register_uri(
20
            httpretty.GET,
21
            "https://api.paystack.co/transaction/4013",
22
            content_type='text/json',
23
            body='{"status": true, "contributors": true}',
24
            status=201,
25
        )
26
27
        req = PayStackRequests()
28
        response = req.get('transaction/4013',)
29
        self.assertTrue(response['status'])
30
31
    @httpretty.activate
32
    def test_post_method_called(self):
33
34
        httpretty.register_uri(
35
            httpretty.POST,
36
            "https://api.paystack.co/transaction/charge_token",
37
            content_type='text/json',
38
            body='{"status": true, "contributors": null}',
39
            status=302,
40
        )
41
42
        req = PayStackRequests()
43
        response = req.post('transaction/charge_token',
44
                            data={'track': 'requests'})
45
        self.assertTrue(response['status'])
46
47
    @httpretty.activate
48
    def test_put_method_called(self):
49
50
        httpretty.register_uri(
51
            httpretty.PUT,
52
            "https://api.paystack.co/customer/4013",
53
            content_type='text/json',
54
            body='{"status": true, "contributors": null}',
55
            status=302,
56
        )
57
58
        req = PayStackRequests()
59
        response = req.put('customer/4013',
60
                           data={'test': 'requests'})
61
        self.assertTrue(response['status'])
62