antbob / centos / centpkg

Forked from centos/centpkg a year ago
Clone

Blame tests/test_distgit.py

c0555c
import unittest
c0555c
Brian Stinson 02d712
from .mixins import CatchWarningsMixin
c0555c
from centpkg import DistGitDirectory
c0555c
b9126c
class TestDistGitNothing(unittest.TestCase):
c0555c
    def test_distgit_emptystring(self):
c0555c
        with self.assertRaises(TypeError):
c0555c
            d = DistGitDirectory()
c0555c
6c0f8d
class TestDistGitInvalid(unittest.TestCase):
6c0f8d
    def test_invalid_branchstring_raises(self):
6c0f8d
        self.branchstring = 'nope-not-a-branch'
6c0f8d
6c0f8d
        with self.assertRaises(ValueError):
6c0f8d
            self.d = DistGitDirectory(self.branchstring)
6c0f8d
b9126c
class TestDistgitOnlySig(unittest.TestCase):
b9126c
    def setUp(self):
Brian Stinson 02d712
        self.branchstring = 'c7-sig-cloud'
b9126c
        self.d = DistGitDirectory(self.branchstring)
c0555c
b9126c
    def test_signame_gets_set(self):
b9126c
        self.assertEqual(self.d.signame, 'cloud')
c0555c
b9126c
    def test_centosversion_gets_set(self):
b9126c
        self.assertEqual(self.d.centosversion, '7')
c0555c
b9126c
    def test_projectname_gets_set(self):
b9126c
        self.assertEqual(self.d.projectname, None)
c0555c
b9126c
    def test_releasename_gets_set(self):
b9126c
        self.assertEqual(self.d.releasename, None)
c0555c
47c4aa
    def test_target_gets_set(self):
47c4aa
        self.assertEqual(self.d.target, 'cloud7-common-el7')
47c4aa
3a7531
class TestDistgitSigAndCommon(unittest.TestCase):
3a7531
    def setUp(self):
Brian Stinson 02d712
        self.branchstring = 'c7-sig-cloud-common'
3a7531
        self.d = DistGitDirectory(self.branchstring)
3a7531
3a7531
    def test_signame_gets_set(self):
3a7531
        self.assertEqual(self.d.signame, 'cloud')
3a7531
3a7531
    def test_centosversion_gets_set(self):
3a7531
        self.assertEqual(self.d.centosversion, '7')
3a7531
3a7531
    def test_projectname_gets_set(self):
3a7531
        self.assertEqual(self.d.projectname, None)
3a7531
3a7531
    def test_releasename_gets_set(self):
3a7531
        self.assertEqual(self.d.releasename, None)
3a7531
3a7531
    def test_target_gets_set(self):
3a7531
        self.assertEqual(self.d.target, 'cloud7-common-el7')
3a7531
b9126c
class TestDistgitSigAndProject(unittest.TestCase):
b9126c
    def setUp(self):
Brian Stinson 02d712
        self.branchstring = 'c7-sig-cloud-openstack'
b9126c
        self.d = DistGitDirectory(self.branchstring)
c0555c
b9126c
    def test_signame_gets_set(self):
b9126c
        self.assertEqual(self.d.signame, 'cloud')
b9126c
b9126c
    def test_centosversion_gets_set(self):
b9126c
        self.assertEqual(self.d.centosversion, '7')
b9126c
b9126c
    def test_projectname_gets_set(self):
b9126c
        self.assertEqual(self.d.projectname, 'openstack')
b9126c
b9126c
    def test_releasename_gets_set(self):
b9126c
        self.assertEqual(self.d.releasename, None)
b9126c
f7e2af
    def test_target_gets_set(self):
f7e2af
        self.assertEqual(self.d.target, 'cloud7-openstack-common-el7')
f7e2af
3a7531
class TestDistgitSigProjectAndCommon(unittest.TestCase):
3a7531
    def setUp(self):
Brian Stinson 02d712
        self.branchstring = 'c7-sig-cloud-openstack-common'
3a7531
        self.d = DistGitDirectory(self.branchstring)
3a7531
3a7531
    def test_signame_gets_set(self):
3a7531
        self.assertEqual(self.d.signame, 'cloud')
3a7531
3a7531
    def test_centosversion_gets_set(self):
3a7531
        self.assertEqual(self.d.centosversion, '7')
3a7531
3a7531
    def test_projectname_gets_set(self):
3a7531
        self.assertEqual(self.d.projectname, 'openstack')
3a7531
3a7531
    def test_releasename_gets_set(self):
3a7531
        self.assertEqual(self.d.releasename, None)
3a7531
3a7531
    def test_target_gets_set(self):
3a7531
        self.assertEqual(self.d.target, 'cloud7-openstack-common-el7')
3a7531
b9126c
class TestDistgitSigProjectAndRelease(unittest.TestCase):
b9126c
    def setUp(self):
Brian Stinson 02d712
        self.branchstring = 'c7-sig-cloud-openstack-kilo'
b9126c
        self.d = DistGitDirectory(self.branchstring)
b9126c
b9126c
    def test_signame_gets_set(self):
b9126c
        self.assertEqual(self.d.signame, 'cloud')
b9126c
b9126c
    def test_centosversion_gets_set(self):
b9126c
        self.assertEqual(self.d.centosversion, '7')
b9126c
b9126c
    def test_projectname_gets_set(self):
b9126c
        self.assertEqual(self.d.projectname, 'openstack')
b9126c
b9126c
    def test_releasename_gets_set(self):
b9126c
        self.assertEqual(self.d.releasename, 'kilo')
c8beba
c8beba
    def test_target_gets_set(self):
c8beba
        self.assertEqual(self.d.target, 'cloud7-openstack-kilo-el7')
c8beba
a6e9d6
class TestDistgitC7DistroBranch(unittest.TestCase):
a6e9d6
    def setUp(self):
a6e9d6
        self.branchstring = 'c7'
a6e9d6
        self.d = DistGitDirectory(self.branchstring)
a6e9d6
a6e9d6
    def test_signame_gets_set(self):
a6e9d6
        self.assertEqual(self.d.signame, 'centos')
a6e9d6
a6e9d6
    def test_centosversion_gets_set(self):
a6e9d6
        self.assertEqual(self.d.centosversion, '7')
a6e9d6
a6e9d6
    def test_projectname_gets_set(self):
a6e9d6
        self.assertEqual(self.d.projectname, None)
a6e9d6
a6e9d6
    def test_releasename_gets_set(self):
a6e9d6
        self.assertEqual(self.d.releasename, None)
a6e9d6
a6e9d6
    def test_target_gets_set(self):
a6e9d6
        self.assertEqual(self.d.target, 'c7')
a6e9d6
a6e9d6
class TestDistgitC6DistroBranch(unittest.TestCase):
a6e9d6
    def setUp(self):
a6e9d6
        self.branchstring = 'c6'
a6e9d6
        self.d = DistGitDirectory(self.branchstring)
a6e9d6
a6e9d6
    def test_signame_gets_set(self):
a6e9d6
        self.assertEqual(self.d.signame, 'centos')
a6e9d6
a6e9d6
    def test_centosversion_gets_set(self):
a6e9d6
        self.assertEqual(self.d.centosversion, '6')
a6e9d6
a6e9d6
    def test_projectname_gets_set(self):
a6e9d6
        self.assertEqual(self.d.projectname, None)
a6e9d6
a6e9d6
    def test_releasename_gets_set(self):
a6e9d6
        self.assertEqual(self.d.releasename, None)
a6e9d6
a6e9d6
    def test_target_gets_set(self):
a6e9d6
        self.assertEqual(self.d.target, 'c6')
867964
867964
class TestDistgitC6PlusDistroBranch(unittest.TestCase):
867964
    def setUp(self):
867964
        self.branchstring = 'c6-plus'
867964
        self.d = DistGitDirectory(self.branchstring)
867964
867964
    def test_signame_gets_set(self):
867964
        self.assertEqual(self.d.signame, 'centos')
867964
867964
    def test_centosversion_gets_set(self):
867964
        self.assertEqual(self.d.centosversion, '6')
867964
867964
    def test_projectname_gets_set(self):
867964
        self.assertEqual(self.d.projectname, 'plus')
867964
867964
    def test_releasename_gets_set(self):
867964
        self.assertEqual(self.d.releasename, None)
867964
867964
    def test_target_gets_set(self):
867964
        self.assertEqual(self.d.target, 'c6-plus')
cf167f
cf167f
class TestOldGitBranch(unittest.TestCase, CatchWarningsMixin):
cf167f
    def test_old_branch_warns(self):
cf167f
       with self.assertWarns(DeprecationWarning):
cf167f
           branchstring = 'virt7'
cf167f
           d = DistGitDirectory(branchstring)