partial work on apply_argspec function

This commit is contained in:
Mike McLean 2016-04-28 12:01:51 -04:00
parent 0faa6e3290
commit 8a8999e01c
2 changed files with 86 additions and 0 deletions

33
tests/test_argspec.py Normal file
View file

@ -0,0 +1,33 @@
#!/usr/bin/python
"""Test argspec functions"""
import koji.tasks
import unittest
class ArgspecCase(unittest.TestCase):
"""Main test case container"""
def test_apply_argspec(self):
"""Test the parse_NVR method"""
# Single param
argspec = (['n'], None, None, None)
self.assertRaises(koji.ParameterError, koji.tasks.apply_argspec,
argspec, (), None )
self.assertRaises(koji.ParameterError, koji.tasks.apply_argspec,
argspec, (1,2), None )
ret = koji.tasks.apply_argspec(argspec, (1,), None)
self.assertEqual(ret, {'n':1})
ret = koji.tasks.apply_argspec(argspec, (), {'n':1})
self.assertEqual(ret, {'n':1})
self.assertRaises(koji.ParameterError, koji.tasks.apply_argspec,
argspec, (1,), {'n':1} )
self.assertRaises(koji.ParameterError, koji.tasks.apply_argspec,
argspec, (1,), {'m':1} )
self.assertRaises(koji.ParameterError, koji.tasks.apply_argspec,
argspec, (), {'m':1} )
if __name__ == '__main__':
unittest.main()