Example #1
0
class BuildTest(unittest.TestCase):
    def setUp(self):
        self.wc = WorkingCopy("build_test")

    def tearDown(self):
        self.wc = None

    @mock.patch('gachette.lib.working_copy.run')
    def test_build(self, fabric_run_mock):
        app_version = '1.1.0'
        webcallback = 'http://garnison.dev:8080/stacks/1234/build_cb'
        self.wc.set_version(app=app_version)
        self.wc.build('/var/gachette/debs', webcallback=webcallback)

        fabric_run_mock.assert_has_calls(
                [mock.call('trebuchet build %s --arch amd64 --output %s %s %s' \
                    % (os.path.join(self.wc.working_copy, '.missile.yml'),
                       '/var/gachette/debs',
                       self.wc.get_version_suffix(),
                       self.wc.get_webcallback_suffix(webcallback)))])
Example #2
0
class BuildTest(unittest.TestCase):
    def setUp(self):
        self.wc = WorkingCopy("build_test")

    def tearDown(self):
        self.wc = None

    @mock.patch('gachette.lib.working_copy.run')
    def test_build(self, fabric_run_mock):
        app_version = '1.1.0'
        webcallback = 'http://garnison.dev:8080/stacks/1234/build_cb'
        self.wc.set_version(app=app_version)
        self.wc.build('/var/gachette/debs', webcallback=webcallback)

        fabric_run_mock.assert_has_calls(
                [mock.call('trebuchet build %s --arch amd64 --output %s %s %s' \
                    % (os.path.join(self.wc.working_copy, '.missile.yml'),
                       '/var/gachette/debs',
                       self.wc.get_version_suffix(),
                       self.wc.get_webcallback_suffix(webcallback)))])
Example #3
0
class VersionTest(unittest.TestCase):
    def setUp(self):
        self.wc = WorkingCopy("version_test")

    def tearDown(self):
        self.wc = None

    def test_app_version(self):
        self.wc.set_version(app='1.2.3')
        self.assertEqual(
            self.wc.get_version_suffix(), " --app-version 1.2.3",
            "app version is not well recognized (%s)" %
            self.wc.get_version_suffix())

        self.wc.set_version(app='1.2.4')
        self.assertEqual(
            self.wc.get_version_suffix(), " --app-version 1.2.4",
            "app version is updated properly (%s)" %
            self.wc.get_version_suffix())

        self.wc.set_version(app='')
        self.assertEqual(
            self.wc.get_version_suffix(), "",
            "app version is removed properly (%s)" %
            self.wc.get_version_suffix())

    def test_env_version(self):
        self.wc.set_version(env='1.2.3')
        self.assertEqual(
            self.wc.get_version_suffix(), " --env-version 1.2.3",
            "env version is not well recognized (%s)" %
            self.wc.get_version_suffix())

    def test_service_version(self):
        self.wc.set_version(service='1.2.3')
        self.assertEqual(
            self.wc.get_version_suffix(), " --service-version 1.2.3",
            "service version is not well recognized (%s)" %
            self.wc.get_version_suffix())

    def test_multiple_version(self):
        self.wc.set_version(app='1.2.3')
        self.wc.set_version(env='2.3.4')
        self.assertEqual(
            self.wc.get_version_suffix(),
            " --app-version 1.2.3 --env-version 2.3.4",
            "env and app version are not well recognized (%s)" %
            self.wc.get_version_suffix())
        self.wc.set_version(service='3.4.5')
        self.assertEqual(
            self.wc.get_version_suffix(),
            " --app-version 1.2.3 --env-version 2.3.4 --service-version 3.4.5",
            "service, env and app version are not well recognized (%s)" %
            self.wc.get_version_suffix())

    def test_all_version(self):
        self.wc.set_version(service='3.4.5')
        self.wc.set_version(app='1.2.3')
        self.wc.set_version(env='2.3.4')
        self.assertEqual(
            self.wc.get_version_suffix(),
            " --app-version 1.2.3 --env-version 2.3.4 --service-version 3.4.5",
            "service, env and app version are sorted properly (%s)" %
            self.wc.get_version_suffix())
Example #4
0
class VersionTest(unittest.TestCase):
    def setUp(self):
        self.wc = WorkingCopy("version_test")

    def tearDown(self):
        self.wc = None

    def test_app_version(self):
        self.wc.set_version(app='1.2.3')
        self.assertEqual(self.wc.get_version_suffix(), " --app-version 1.2.3", 
                        "app version is not well recognized (%s)" % self.wc.get_version_suffix())

        self.wc.set_version(app='1.2.4')
        self.assertEqual(self.wc.get_version_suffix(), " --app-version 1.2.4", 
                        "app version is updated properly (%s)" % self.wc.get_version_suffix())

        self.wc.set_version(app='')
        self.assertEqual(self.wc.get_version_suffix(), "",
                        "app version is removed properly (%s)" % self.wc.get_version_suffix())

    def test_env_version(self):
        self.wc.set_version(env='1.2.3')
        self.assertEqual(self.wc.get_version_suffix(), " --env-version 1.2.3", 
                        "env version is not well recognized (%s)" % self.wc.get_version_suffix())

    def test_service_version(self):
        self.wc.set_version(service='1.2.3')
        self.assertEqual(self.wc.get_version_suffix(), " --service-version 1.2.3", 
                        "service version is not well recognized (%s)" % self.wc.get_version_suffix())

    def test_multiple_version(self):
        self.wc.set_version(app='1.2.3')
        self.wc.set_version(env='2.3.4')
        self.assertEqual(self.wc.get_version_suffix(), " --app-version 1.2.3 --env-version 2.3.4",
                        "env and app version are not well recognized (%s)" % self.wc.get_version_suffix())
        self.wc.set_version(service='3.4.5')
        self.assertEqual(self.wc.get_version_suffix(), " --app-version 1.2.3 --env-version 2.3.4 --service-version 3.4.5",
                        "service, env and app version are not well recognized (%s)" % self.wc.get_version_suffix())

    def test_all_version(self):
        self.wc.set_version(service='3.4.5')
        self.wc.set_version(app='1.2.3')
        self.wc.set_version(env='2.3.4')
        self.assertEqual(self.wc.get_version_suffix(), " --app-version 1.2.3 --env-version 2.3.4 --service-version 3.4.5", 
                        "service, env and app version are sorted properly (%s)" % self.wc.get_version_suffix())