add new feeds
This commit is contained in:
@@ -10,7 +10,7 @@ import utilities.file_methods as fm
|
||||
class TestFeed(unittest.TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.testFeed = Feed("sbk", "podcast", "application/x-bittorrent", "testfeeds/podcast/sbk/sbk.xml")
|
||||
self.testFeed = Feed("sbk", "podcast", "audio/opus", "testfeeds/podcast/sbk/sbk.xml")
|
||||
|
||||
def test_load_new_feed(self):
|
||||
fm.check_and_remove_file("testfeeds/podcast/sbk/sbk.json")
|
||||
@@ -103,6 +103,45 @@ class TestFeed(unittest.TestCase):
|
||||
self.assertRaises(AssertionError, Feed.create_feed_config_file, "sbk", "podcast",
|
||||
"audiomg", None)
|
||||
|
||||
def test_create_feed_from_feed_config(self):
|
||||
newFeed = Feed.create_feed_from_feed_config(self.testFeed.feed_config)
|
||||
self.assertEqual(self.testFeed.config_path, newFeed.config_path)
|
||||
self.assertEqual(self.testFeed.feed_file_path, newFeed.feed_file_path)
|
||||
self.assertEqual(self.testFeed.feed_folder, newFeed.feed_folder)
|
||||
self.assertEqual(self.testFeed.feed_folder_path, newFeed.feed_folder_path)
|
||||
|
||||
def test_create_feed_from_feed_config_error(self):
|
||||
self.assertRaises(AssertionError, Feed.create_feed_from_feed_config, None)
|
||||
|
||||
def test_create_feed_from_feed_config_path(self):
|
||||
newFeed = Feed.create_feed_from_feed_config_path(self.testFeed.config_path)
|
||||
self.assertEqual(self.testFeed.config_path, newFeed.config_path)
|
||||
self.assertEqual(self.testFeed.feed_file_path, newFeed.feed_file_path)
|
||||
self.assertEqual(self.testFeed.feed_folder, newFeed.feed_folder)
|
||||
self.assertEqual(self.testFeed.feed_folder_path, newFeed.feed_folder_path)
|
||||
|
||||
def test_create_feed_from_feed_config_path_error(self):
|
||||
self.assertRaises(TypeError, Feed.create_feed_from_feed_config_path, None)
|
||||
self.assertRaises(AssertionError, Feed.create_feed_from_feed_config_path, "/root")
|
||||
self.assertRaises(AssertionError, Feed.create_feed_from_feed_config_path, ".")
|
||||
self.assertRaises(AssertionError, Feed.create_feed_from_feed_config_path, "bla.json")
|
||||
|
||||
def test_create_feed_from_feed_folder_path(self):
|
||||
newFeed = Feed.create_feed_from_feed_folder_path(self.testFeed.feed_folder_path)
|
||||
self.assertEqual(self.testFeed.config_path, newFeed.config_path)
|
||||
self.assertEqual(self.testFeed.feed_file_path, newFeed.feed_file_path)
|
||||
self.assertEqual(self.testFeed.feed_folder, newFeed.feed_folder)
|
||||
self.assertEqual(self.testFeed.feed_folder_path, newFeed.feed_folder_path)
|
||||
|
||||
def test_create_feed_from_feed_folder_path_error(self):
|
||||
self.assertRaises(TypeError, Feed.create_feed_from_feed_folder_path, None)
|
||||
self.assertRaises(IndexError, Feed.create_feed_from_feed_folder_path, "/root")
|
||||
self.assertRaises(IndexError, Feed.create_feed_from_feed_folder_path, ".")
|
||||
self.assertRaises(AssertionError, Feed.create_feed_from_feed_folder_path, "bla.json")
|
||||
|
||||
def test_create_feeds_from_storage_folder(self):
|
||||
feeds = Feed.create_feeds_from_storage_folder()
|
||||
self.assertEqual(2, len(feeds))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"LinkType": "application/x-bittorrent",
|
||||
"FeedUrl": "http://www.staatsbuergerkunde-podcast.de/feed/mp3-rss/",
|
||||
"FeedType": "podcast",
|
||||
"FeedName": "sbk"
|
||||
}
|
||||
0
testenv/tests/webpage/cgitestrun/dummy
Normal file
0
testenv/tests/webpage/cgitestrun/dummy
Normal file
@@ -1,8 +1,18 @@
|
||||
import unittest
|
||||
import os
|
||||
import shutil
|
||||
import ui.web.cgi.cgi_server as cgis
|
||||
|
||||
class WebServerTest(unittest.TestCase):
|
||||
|
||||
class MyTestCase(unittest.TestCase):
|
||||
def test_something(self):
|
||||
def test_runServer(self):
|
||||
|
||||
if os.path.exists("./tests/webpage/cgitestrun"):
|
||||
shutil.rmtree("./tests/webpage/cgitestrun")
|
||||
|
||||
os.mkdir("./tests/webpage/cgitestrun")
|
||||
shutil.copytree("testfeeds/","./tests/webpage/cgitestrun/testfeeds/")
|
||||
cgis.runServer("./tests/webpage/cgitestrun")
|
||||
self.assertEqual(True, False)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user