From c0555c1202dc707ac04489830c8a8e35dd14d7c4 Mon Sep 17 00:00:00 2001 From: Brian Stinson Date: Jul 19 2015 20:28:14 +0000 Subject: let's get started on a test suite --- diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..661012a --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,5 @@ +import os +import sys + +sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), + '../src')) diff --git a/tests/test_distgit.py b/tests/test_distgit.py new file mode 100644 index 0000000..a597016 --- /dev/null +++ b/tests/test_distgit.py @@ -0,0 +1,41 @@ +import os +import sys +import unittest + + +print sys.path + +from centpkg import DistGitDirectory + +class TestDistGitDirectory(unittest.TestCase): + def test_distgit_emptystring(self): + with self.assertRaises(TypeError): + d = DistGitDirectory() + + def test_distgit_only_sig(self): + branchstring = 'sig-cloud7' + d = DistGitDirectory(branchstring) + + self.assertEqual(d.signame, 'cloud') + self.assertEqual(d.centosversion, '7') + self.assertEqual(d.projectname, None) + self.assertEqual(d.releasename, None) + + def test_distgit_sig_and_project(self): + branchstring = 'sig-cloud7-openstack' + d = DistGitDirectory(branchstring) + + self.assertEqual(d.signame, 'cloud') + self.assertEqual(d.centosversion, '7') + self.assertEqual(d.projectname, 'openstack') + self.assertEqual(d.releasename, None) + + def test_distgit_sig_project_and_release(self): + branchstring = 'sig-cloud7-openstack-kilo' + d = DistGitDirectory(branchstring) + + self.assertEqual(d.signame, 'cloud') + self.assertEqual(d.centosversion, '7') + self.assertEqual(d.projectname, 'openstack') + self.assertEqual(d.releasename, 'kilo') +