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

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)

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