def test_given_any_option_then_set_area_called_with_default_area_option(
        self, mock_set, _1):
        options = FakeOptions()

        dls_release.create_build_object(options)

        mock_set.assert_called_once_with(options.area)
Beispiel #2
0
    def test_given_any_option_then_set_force_called_with_default_force_option(
            self, mock_set, _1):
        options = FakeOptions()

        dls_release.create_build_object(options)

        mock_set.assert_called_once_with(None)
    def test_given_force_option_then_set_force_called_with_given_force_option(self, mock_set, _1):
        force = True
        options = FakeOptions(force=force)

        dls_release.create_build_object(options)

        mock_set.assert_called_once_with(True)
    def test_given_empty_options_then_default_build_called_with_None(self, mock_default):

        options = FakeOptions()
        dls_release.create_build_object(options)

        self.assertTrue(mock_default.called)
        mock_default.assert_called_once_with(None)
    def test_given_area_option_then_set_area_called_with_given_area_option(self, mock_set, _1):
        area = 'python'

        options = FakeOptions(area=area)

        dls_release.create_build_object(options)

        mock_set.assert_called_once_with(options.area)
    def test_given_windows_option_without_rhel_then_WindowsBuild_called_with_windows_and_epics_version(self, mock_build):
        windows = 'xp'

        options = FakeOptions(windows=windows)

        dls_release.create_build_object(options)

        mock_build.assert_called_once_with(windows, None)
    def test_given_rhel_version_then_RedhatBuild_called_with_rhel_and_epics_version(self, mock_default):
        rhel_version = "25"

        options = FakeOptions(rhel_version=rhel_version)

        dls_release.create_build_object(options)

        mock_default.assert_called_once_with(rhel_version, None)
Beispiel #8
0
    def test_given_empty_options_then_default_build_called_with_None(
            self, mock_default):

        options = FakeOptions()
        dls_release.create_build_object(options)

        self.assertTrue(mock_default.called)
        mock_default.assert_called_once_with(None)
    def test_given_epics_version_then_default_build_called_with_epics_version(self, mock_default):
        version = "R3.14.12.3"

        options = FakeOptions(epics_version=version)

        dls_release.create_build_object(options)

        mock_default.assert_called_once_with(version)
Beispiel #10
0
    def test_given_force_option_then_set_force_called_with_given_force_option(
            self, mock_set, _1):
        force = True
        options = FakeOptions(force=force)

        dls_release.create_build_object(options)

        mock_set.assert_called_once_with(True)
Beispiel #11
0
    def test_given_area_option_then_set_area_called_with_given_area_option(
            self, mock_set, _1):
        area = 'python'

        options = FakeOptions(area=area)

        dls_release.create_build_object(options)

        mock_set.assert_called_once_with(options.area)
Beispiel #12
0
    def test_given_windows_option_without_rhel_then_WindowsBuild_called_with_windows_and_epics_version(
            self, mock_build):
        windows = 'xp'

        options = FakeOptions(windows=windows)

        dls_release.create_build_object(options)

        mock_build.assert_called_once_with(windows, None)
Beispiel #13
0
    def test_given_rhel_version_then_RedhatBuild_called_with_rhel_and_epics_version(
            self, mock_default):
        rhel_version = "25"

        options = FakeOptions(rhel_version=rhel_version)

        dls_release.create_build_object(options)

        mock_default.assert_called_once_with(rhel_version, None)
Beispiel #14
0
    def test_given_epics_version_then_default_build_called_with_epics_version(
            self, mock_default):
        version = "R3.14.12.3"

        options = FakeOptions(epics_version=version)

        dls_release.create_build_object(options)

        mock_default.assert_called_once_with(version)
    def test_given_rhel_version_then_RedhatBuild_called_with_rhel_and_epics_version(self, mock_build):
        rhel_version = "25"
        epics_version = "R3.14.12.3"

        options = FakeOptions(
            rhel_version=rhel_version,
            epics_version=epics_version)

        dls_release.create_build_object(options)

        mock_build.assert_called_once_with(rhel_version,epics_version)
Beispiel #16
0
    def test_given_rhel_version_then_RedhatBuild_called_with_rhel_and_epics_version(
            self, mock_build):
        rhel_version = "25"
        epics_version = "R3.14.12.3"

        options = FakeOptions(rhel_version=rhel_version,
                              epics_version=epics_version)

        dls_release.create_build_object(options)

        mock_build.assert_called_once_with(rhel_version, epics_version)
    def test_if_area_not_support_or_ioc_then_return_string_without_epics_specified(self, _1):

        module = 'dummy'
        version = '1-0'
        branch = None
        area = 'python'
        options = FakeOptions(area='python')
        build = dls_release.create_build_object(options)

        returned_message = dls_release.construct_info_message(
            module, branch, area, version, build)

        self.assertFalse('epics' in returned_message)
        self.assertFalse(build.epics() in returned_message)
Beispiel #18
0
    def test_if_area_not_support_or_ioc_then_return_string_without_epics_specified(
            self, _1):

        module = 'dummy'
        version = '1-0'
        branch = None
        area = 'python'
        options = FakeOptions(area='python')
        build = dls_release.create_build_object(options)

        returned_message = dls_release.construct_info_message(
            module, branch, area, version, build)

        self.assertFalse('epics' in returned_message)
        self.assertFalse(build.epics() in returned_message)
    def test_given_default_args_and_ioc_area_then_construct_specific_string(self, _1):

        module = 'dummy'
        version = '1-0'
        area = 'ioc'
        branch = None
        options = FakeOptions(area='ioc')
        build = dls_release.create_build_object(options)

        expected_message = 'Releasing {module} {version} from trunk, '.format(module=module, version=version)
        expected_message += 'using {} build server'.format(build.get_server())
        expected_message += ' and epics {}'.format(build.epics())

        returned_message = dls_release.construct_info_message(
            module, branch, area, version, build)

        self.assertEqual(expected_message, returned_message)
Beispiel #20
0
    def test_given_default_args_then_construct_specific_string(self, _1):

        module = 'dummy'
        version = '1-0'
        branch = None
        area = "support"
        options = FakeOptions()
        build = dls_release.create_build_object(options)

        expected_message = '{module} {version} from tag {version}, '.format(
            module=module, version=version)
        expected_message += 'using {} build server'.format(build.get_server())
        expected_message += ' and epics {}'.format(build.epics())

        returned_message = dls_release.construct_info_message(
            module, branch, area, version, build)

        self.assertEqual(expected_message, returned_message)
    def test_given_default_args_and_branch_then_construct_specific_string_referencing_branch(self, _1):

        module = 'dummy'
        version = '3-5'
        branch = 'new_feature'
        area = 'support'
        options = FakeOptions(branch='new_feature')
        build = dls_release.create_build_object(options)

        expected_message = \
            'Releasing {module} {version} from branch {branch}, '.format(module=module, version=version, branch=branch)
        expected_message += 'using {} build server'.format(build.get_server())
        expected_message += ' and epics {}'.format(build.epics())

        returned_message = dls_release.construct_info_message(
            module, branch, area, version, build)

        self.assertEqual(expected_message, returned_message)
Beispiel #22
0
    def test_given_default_args_and_branch_then_construct_specific_string_referencing_branch(
            self, _1):

        module = 'dummy'
        version = '3-5'
        branch = 'new_feature'
        area = 'support'
        options = FakeOptions(branch='new_feature')
        build = dls_release.create_build_object(options)

        expected_message = \
            '{module} {version} from branch {branch}, '.format(module=module, version=version, branch=branch)
        expected_message += 'using {} build server'.format(build.get_server())
        expected_message += ' and epics {}'.format(build.epics())

        returned_message = dls_release.construct_info_message(
            module, branch, area, version, build)

        self.assertEqual(expected_message, returned_message)