Files
feedcrawler/testenv/tests/config/testconfig.py
2016-07-01 09:39:03 +02:00

49 lines
1.4 KiB
Python
Executable File

__author__ = 'dev'
import unittest
import os.path
from config.config import Config
class TestConfig(unittest.TestCase):
def test_key_not_exists(self):
value = Config.get("not_existing_config_key")
self.assertIsNone(value)
def test_feed_types(self):
types = Config.get("FeedTypes")
self.assertIsNotNone(types)
self.assertIsInstance(types, set)
def test_feed_link_types(self):
types = Config.get("FeedLinkTypes")
self.assertIsNotNone(types)
self.assertIsInstance(types, set)
def test_feed_storage_folder(self):
path = Config.get("FeedStorageFolder")
self.assertIsNotNone(path)
self.assertIsInstance(path, str)
self.assertTrue(os.path.isdir(path))
def test_feed_storage_prefix(self):
prefix = Config.get("FeedStoragePrefix")
self.assertIsNotNone(prefix)
self.assertIsInstance(prefix, dict)
def test_feed_config_file_suffix(self):
suffix = Config.get("ConfigFileSuffix")
self.assertIsNotNone(suffix)
self.assertIsInstance(suffix, str)
def test_feed_config_file_extension(self):
extension = Config.get("ConfigFileExtension")
self.assertIsNotNone(extension)
self.assertIsInstance(extension, str)
self.assertIn(".", extension)
if __name__ == '__main__':
unittest.main()