__author__ = 'dev'

import unittest
import urllib.request
import urllib.error
from config.stream_list import web_stream_list as wsl


class TestStreamList(unittest.TestCase):

    def setUp(self):
        self.__stream_url = wsl.values()

    def test_stream_available(self):
        for url in self.__stream_url:
            response = urllib.request.urlopen(url)
            self.assertEqual(200, response.getcode())

    def test_stream_wrong_url(self):
        self.__stream_url = "http://wrong.stream"
        self.assertRaises(urllib.error.URLError, urllib.request.urlopen, self.__stream_url)


if __name__ == '__main__':
    unittest.main()
