zlopez / centos / centpkg

Forked from centos/centpkg 3 years ago
Clone
Blob Blame History Raw
import os
import sys
import unittest


print sys.path

from centpkg import DistGitDirectory

class TestDistGitNothing(unittest.TestCase):
    def test_distgit_emptystring(self):
        with self.assertRaises(TypeError):
            d = DistGitDirectory()

class TestDistGitInvalid(unittest.TestCase):
    def test_invalid_branchstring_raises(self):
        self.branchstring = 'nope-not-a-branch'

        with self.assertRaises(ValueError):
            self.d = DistGitDirectory(self.branchstring)

class TestDistgitOnlySig(unittest.TestCase):
    def setUp(self):
        self.branchstring = 'sig-cloud7'
        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, None)

    def test_releasename_gets_set(self):
        self.assertEqual(self.d.releasename, None)

    def test_target_gets_set(self):
        self.assertEqual(self.d.target, 'cloud7-common-el7')

class TestDistgitSigAndCommon(unittest.TestCase):
    def setUp(self):
        self.branchstring = 'sig-cloud7-common'
        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, None)

    def test_releasename_gets_set(self):
        self.assertEqual(self.d.releasename, None)

    def test_target_gets_set(self):
        self.assertEqual(self.d.target, 'cloud7-common-el7')

class TestDistgitSigAndProject(unittest.TestCase):
    def setUp(self):
        self.branchstring = 'sig-cloud7-openstack'
        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)

    def test_target_gets_set(self):
        self.assertEqual(self.d.target, 'cloud7-openstack-common-el7')

class TestDistgitSigProjectAndCommon(unittest.TestCase):
    def setUp(self):
        self.branchstring = 'sig-cloud7-openstack-common'
        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)

    def test_target_gets_set(self):
        self.assertEqual(self.d.target, 'cloud7-openstack-common-el7')

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')

    def test_target_gets_set(self):
        self.assertEqual(self.d.target, 'cloud7-openstack-kilo-el7')