diff options
author | Daniel Baumann <daniel@debian.org> | 2024-12-12 12:17:53 +0100 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2024-12-12 12:17:53 +0100 |
commit | 11cb8088832071b55bba2aff046d1542dda46fed (patch) | |
tree | d3f24cca0040ee5587df8c9e10371d05f206f94a /tests/test_main.py | |
parent | Initial commit. (diff) | |
download | python-feedgen-11cb8088832071b55bba2aff046d1542dda46fed.tar.xz python-feedgen-11cb8088832071b55bba2aff046d1542dda46fed.zip |
Adding upstream version 1.0.0.upstream/1.0.0upstream
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to '')
-rw-r--r-- | tests/test_main.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test_main.py b/tests/test_main.py new file mode 100644 index 0000000..af7e981 --- /dev/null +++ b/tests/test_main.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +''' +Tests for feedgen main +''' + +import os +import sys +import tempfile +import unittest + +from feedgen import __main__ + + +class TestSequenceFunctions(unittest.TestCase): + + def test_usage(self): + sys.argv = ['feedgen'] + with self.assertRaises(SystemExit) as e: + __main__.main() + self.assertEqual(e.exception.code, None) + + def test_feed(self): + for ftype in 'rss', 'atom', 'podcast', 'torrent', 'dc.rss', \ + 'dc.atom', 'syndication.rss', 'syndication.atom': + sys.argv = ['feedgen', ftype] + __main__.main() + + def test_file(self): + for extemsion in '.atom', '.rss': + fh, filename = tempfile.mkstemp(extemsion) + sys.argv = ['feedgen', filename] + try: + __main__.main() + finally: + os.close(fh) + os.remove(filename) |