2015-07-19 15:20:53 -05:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
|
|
print sys.path
|
|
|
|
|
|
|
|
from centpkg import DistGitDirectory
|
|
|
|
|
2015-07-19 21:03:29 -05:00
|
|
|
class TestDistGitNothing(unittest.TestCase):
|
2015-07-19 15:20:53 -05:00
|
|
|
def test_distgit_emptystring(self):
|
|
|
|
with self.assertRaises(TypeError):
|
|
|
|
d = DistGitDirectory()
|
|
|
|
|
2015-07-19 21:03:29 -05:00
|
|
|
class TestDistgitOnlySig(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
|
|
self.branchstring = 'sig-cloud7'
|
|
|
|
self.d = DistGitDirectory(self.branchstring)
|
2015-07-19 15:20:53 -05:00
|
|
|
|
2015-07-19 21:03:29 -05:00
|
|
|
def test_signame_gets_set(self):
|
|
|
|
self.assertEqual(self.d.signame, 'cloud')
|
2015-07-19 15:20:53 -05:00
|
|
|
|
2015-07-19 21:03:29 -05:00
|
|
|
def test_centosversion_gets_set(self):
|
|
|
|
self.assertEqual(self.d.centosversion, '7')
|
2015-07-19 15:20:53 -05:00
|
|
|
|
2015-07-19 21:03:29 -05:00
|
|
|
def test_projectname_gets_set(self):
|
|
|
|
self.assertEqual(self.d.projectname, None)
|
2015-07-19 15:20:53 -05:00
|
|
|
|
2015-07-19 21:03:29 -05:00
|
|
|
def test_releasename_gets_set(self):
|
|
|
|
self.assertEqual(self.d.releasename, None)
|
2015-07-19 15:20:53 -05:00
|
|
|
|
2015-07-19 21:03:29 -05:00
|
|
|
class TestDistgitSigAndProject(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
|
|
self.branchstring = 'sig-cloud7-openstack'
|
|
|
|
self.d = DistGitDirectory(self.branchstring)
|
2015-07-19 15:20:53 -05:00
|
|
|
|
2015-07-19 21:03:29 -05:00
|
|
|
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')
|
2015-07-19 21:36:17 -05:00
|
|
|
|
|
|
|
def test_target_gets_set(self):
|
|
|
|
self.assertEqual(self.d.target, 'cloud7-openstack-kilo-el7')
|
|
|
|
|