diff --git a/src/config/config.py b/src/config/config.py index f8bf4e8..23c211f 100644 --- a/src/config/config.py +++ b/src/config/config.py @@ -1 +1,8 @@ __author__ = 'dev' + +Config = { + "FeedLinkTypes" : {"application/x-bittorrent","mp3"}, + "FeedTypes" : {"podcast","rss"}, + "FeedStorageFolder" : "testfeeds", + "FeedStoragePrefix" : { "0" : "FeedTypes"} +} \ No newline at end of file diff --git a/src/feed/feed.py b/src/feed/feed.py index f8bf4e8..7118ff8 100644 --- a/src/feed/feed.py +++ b/src/feed/feed.py @@ -1 +1,6 @@ __author__ = 'dev' + +class Feed: + + def __init__(self): + self.valid_file_types = {"application/x-bittorrent","mp3"} \ No newline at end of file diff --git a/testenv/testfeeds/podcast/sbk-config.json b/testenv/testfeeds/podcast/sbk-config.json index e69de29..b59dcbe 100644 --- a/testenv/testfeeds/podcast/sbk-config.json +++ b/testenv/testfeeds/podcast/sbk-config.json @@ -0,0 +1,4 @@ +{ + "FeedUrl" : "http://www.staatsbuergerkunde-podcast.de/feed/mp3-rss/" + "LinkType" : "application/x-bittorrent" +} \ No newline at end of file diff --git a/testenv/tests/config/testconfig.py b/testenv/tests/config/testconfig.py index ee73c95..74d7927 100644 --- a/testenv/tests/config/testconfig.py +++ b/testenv/tests/config/testconfig.py @@ -1,11 +1,36 @@ __author__ = 'dev' import unittest +import os.path +from config.config import Config -class MyTestCase(unittest.TestCase): - def test_something(self): - self.assertEqual(True, False) +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) if __name__ == '__main__': diff --git a/testenv/tests/feed/testfeed.py b/testenv/tests/feed/testfeed.py index 1619356..51ca99e 100644 --- a/testenv/tests/feed/testfeed.py +++ b/testenv/tests/feed/testfeed.py @@ -18,8 +18,6 @@ class TestFeed(unittest.TestCase): def test_setup_feed(self, name, url, feed_type): self.assertTrue(False) - def test_setup_feed(self, name, url, feed_type): - self.assertTrue(False) if __name__ == '__main__':