python-feedgen/tests/test_main.py
Lars Kiesow c633fd4d64
Add tests for feedgen:main
This patch adds some tests for the main routine of feedgen.

Signed-off-by: Lars Kiesow <lkiesow@uos.de>
2017-03-13 21:02:02 +01:00

40 lines
960 B
Python

# -*- 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']
try:
__main__.main()
except BaseException as e:
assert e.code is None
def test_feed(self):
for ftype in 'rss', 'atom', 'podcast', 'torrent', 'dc.rss', 'dc.atom',\
'syndication.rss', 'syndication.atom':
sys.argv = ['feedgen', ftype]
try:
__main__.main()
except:
assert False
def test_file(self):
for extemsion in '.atom', '.rss':
_, filename = tempfile.mkstemp(extemsion)
sys.argv = ['feedgen', filename]
try:
__main__.main()
except:
assert False
os.remove(filename)