Skip to content
Snippets Groups Projects
test_pod_client.py 1023 B
Newer Older
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from unittest import TestCase
from pod_client.PodClient import PodClient
from pod_client.Resource import Resource, API_URLS


HOST = 'http://pod.ubicast.net'
API_KEY = os.environ.get('POD_UNIT_TEST_API_KEY')


def setUpModule():
    pass


def tearDownModule():
    pass


class PodClientTest(TestCase):

    def test_init(self):
        self.assertTrue(API_KEY)
        pod_client = PodClient(HOST, API_KEY)
        for key in API_URLS.keys():
            self.assertTrue(hasattr(pod_client, key))
            self.assertTrue(isinstance(getattr(pod_client, key), Resource))
        success = True
        try:
            pod_client = PodClient('', API_KEY)
        except Exception:
            success = False
        self.assertFalse(success)
        success = True
        try:
            pod_client = PodClient(HOST, '')
        except Exception:
            success = False
        self.assertFalse(success)

        self.assertTrue(pod_client.videos.get())