Example #1
0
class TrafficWrapperTest(TestCase):

    def setUp(self):
        self._wrapper = TrafficWrapper('TOKEN')

    @responses.activate
    def test_001_fetch_traffic_info(self):
        payload = ('{"host1":{"left": 42, "bytes": 12, "links": 12, '
                   '"limit": "8", "type": "links", "extra": 20, '
                   '"reset": "daily"}}')
        responses.add(
            responses.GET,
            'https://api.real-debrid.com/rest/1.0/traffic',
            status=200,
            body=payload,
            content_type='application/json'
        )
        infos = self._wrapper.get_traffic_info()
        assert_true(isinstance(infos, list))
        assert_true(isinstance(infos[0], Traffic))
        tf = infos[0]
        eq_(tf.name, 'host1')
        eq_(tf.type, 'links')
Example #2
0
 def setUp(self):
     self._wrapper = TrafficWrapper('TOKEN')