onosek / 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 TestDistGitDirectory(unittest.TestCase):
    def test_distgit_emptystring(self):
        with self.assertRaises(TypeError):
            d = DistGitDirectory()

    def test_distgit_only_sig(self):
        branchstring = 'sig-cloud7'
        d = DistGitDirectory(branchstring)

        self.assertEqual(d.signame, 'cloud')
        self.assertEqual(d.centosversion, '7')
        self.assertEqual(d.projectname, None)
        self.assertEqual(d.releasename, None)

    def test_distgit_sig_and_project(self):
        branchstring = 'sig-cloud7-openstack'
        d = DistGitDirectory(branchstring)

        self.assertEqual(d.signame, 'cloud')
        self.assertEqual(d.centosversion, '7')
        self.assertEqual(d.projectname, 'openstack')
        self.assertEqual(d.releasename, None)

    def test_distgit_sig_project_and_release(self):
        branchstring = 'sig-cloud7-openstack-kilo'
        d = DistGitDirectory(branchstring)

        self.assertEqual(d.signame, 'cloud')
        self.assertEqual(d.centosversion, '7')
        self.assertEqual(d.projectname, 'openstack')
        self.assertEqual(d.releasename, 'kilo')