refactored tests to classes for each type of input string

This commit is contained in:
Brian Stinson 2015-07-19 21:03:29 -05:00
parent 7ae64c7539
commit b9126c70e0

View file

@ -7,35 +7,58 @@ print sys.path
from centpkg import DistGitDirectory from centpkg import DistGitDirectory
class TestDistGitDirectory(unittest.TestCase): class TestDistGitNothing(unittest.TestCase):
def test_distgit_emptystring(self): def test_distgit_emptystring(self):
with self.assertRaises(TypeError): with self.assertRaises(TypeError):
d = DistGitDirectory() d = DistGitDirectory()
def test_distgit_only_sig(self): class TestDistgitOnlySig(unittest.TestCase):
branchstring = 'sig-cloud7' def setUp(self):
d = DistGitDirectory(branchstring) self.branchstring = 'sig-cloud7'
self.d = DistGitDirectory(self.branchstring)
self.assertEqual(d.signame, 'cloud') def test_signame_gets_set(self):
self.assertEqual(d.centosversion, '7') self.assertEqual(self.d.signame, 'cloud')
self.assertEqual(d.projectname, None)
self.assertEqual(d.releasename, None)
def test_distgit_sig_and_project(self): def test_centosversion_gets_set(self):
branchstring = 'sig-cloud7-openstack' self.assertEqual(self.d.centosversion, '7')
d = DistGitDirectory(branchstring)
self.assertEqual(d.signame, 'cloud') def test_projectname_gets_set(self):
self.assertEqual(d.centosversion, '7') self.assertEqual(self.d.projectname, None)
self.assertEqual(d.projectname, 'openstack')
self.assertEqual(d.releasename, None)
def test_distgit_sig_project_and_release(self): def test_releasename_gets_set(self):
branchstring = 'sig-cloud7-openstack-kilo' self.assertEqual(self.d.releasename, None)
d = DistGitDirectory(branchstring)
self.assertEqual(d.signame, 'cloud') class TestDistgitSigAndProject(unittest.TestCase):
self.assertEqual(d.centosversion, '7') def setUp(self):
self.assertEqual(d.projectname, 'openstack') self.branchstring = 'sig-cloud7-openstack'
self.assertEqual(d.releasename, 'kilo') self.d = DistGitDirectory(self.branchstring)
def test_signame_gets_set(self):
self.assertEqual(self.d.signame, 'cloud')
def test_centosversion_gets_set(self):
self.assertEqual(self.d.centosversion, '7')
def test_projectname_gets_set(self):
self.assertEqual(self.d.projectname, 'openstack')
def test_releasename_gets_set(self):
self.assertEqual(self.d.releasename, None)
class TestDistgitSigProjectAndRelease(unittest.TestCase):
def setUp(self):
self.branchstring = 'sig-cloud7-openstack-kilo'
self.d = DistGitDirectory(self.branchstring)
def test_signame_gets_set(self):
self.assertEqual(self.d.signame, 'cloud')
def test_centosversion_gets_set(self):
self.assertEqual(self.d.centosversion, '7')
def test_projectname_gets_set(self):
self.assertEqual(self.d.projectname, 'openstack')
def test_releasename_gets_set(self):
self.assertEqual(self.d.releasename, 'kilo')