Example #1
0
    def test_given_local_test_possible_then_test_build_performed_once_with_vcs_and_version_as_args(self):

        local_build = False
        version = '0-1'
        vcs = FakeVcs(version=version)
        self.fake_build.test.return_value = 1

        dls_release.perform_test_build(self.fake_build, local_build, vcs)

        self.fake_build.test.assert_called_once_with(vcs)
Example #2
0
    def test_given_local_test_possible_then_test_build_performed_once_with_vcs_and_version_as_args(
            self):

        local_build = False
        version = '0-1'
        module = 'test'
        vcs = FakeVcs(version=version)
        self.fake_build.test.return_value = 1

        dls_release.perform_test_build(self.fake_build, local_build, module,
                                       version, vcs)

        self.fake_build.test.assert_called_once_with(module, version, vcs)
Example #3
0
    def test_given_any_option_when_called_then_return_string_and_test_failure_bool(self):

        local_build = False
        test_message, test_fail = dls_release.perform_test_build(
            self.fake_build, local_build, FakeVcs())

        self.assertIsInstance(test_message, str)
        self.assertIsInstance(test_fail, bool)
Example #4
0
    def test_given_local_test_possible_and_build_fails_then_return_test_failed(self):

        local_build = False
        self.fake_build.test.return_value = 1

        test_message, test_fail = dls_release.perform_test_build(
            self.fake_build, local_build, FakeVcs())

        self.assertTrue(test_fail)
Example #5
0
    def test_given_any_option_when_called_then_return_string_and_test_failure_bool(
            self):

        local_build = False
        module, version = 'test', '1-2-3'
        test_message, test_fail = dls_release.perform_test_build(
            self.fake_build, local_build, module, version, FakeVcs())

        self.assertIsInstance(test_message, str)
        self.assertIsInstance(test_fail, bool)
Example #6
0
    def test_given_local_test_possible_and_build_fails_then_return_test_failed(
            self):

        local_build = False
        module, version = 'test', '1-2-3'
        self.fake_build.test.return_value = 1

        test_message, test_fail = dls_release.perform_test_build(
            self.fake_build, local_build, module, version, FakeVcs())

        self.assertTrue(test_fail)
Example #7
0
    def test_given_test_possible_and_build_works_and_local_build_option_then_message_ends_without_continuation_info(self):

        local_build = True
        self.fake_build.test.return_value = 0
        expected_message = "Performing test build on local system"
        expected_message += '\nTest build successful.'

        test_message, test_fail = dls_release.perform_test_build(
            self.fake_build, local_build, FakeVcs())

        self.assertEqual(test_message, expected_message)
Example #8
0
    def test_given_local_test_build_possible_then_returned_string_begins_with_specific_string(self):

        local_build = False
        expected_message = "Performing test build on local system"

        test_message, test_fail = dls_release.perform_test_build(
            self.fake_build, local_build, FakeVcs())

        self.assertTrue(
            test_message.startswith(expected_message),
            "returned message does not start with expected string")
Example #9
0
    def test_given_local_test_build_not_possible_when_Called_then_return_specific_string(self):

        local_build = False
        self.fake_build.local_test_possible = MagicMock(return_value=False)
        expected_message = "Local test build not possible since local system "
        expected_message += "not the same OS as build server"

        test_message, test_fail = dls_release.perform_test_build(
            self.fake_build, local_build, FakeVcs())

        self.assertEqual(test_message, expected_message)
Example #10
0
    def test_given_test_possible_and_build_works_and_local_build_option_then_message_ends_without_continuation_info(
            self):

        local_build = True
        module, version = 'test', '1-2-3'
        self.fake_build.test.return_value = 0
        expected_message = "Performing test build on local system"
        expected_message += '\nTest build successful.'

        test_message, test_fail = dls_release.perform_test_build(
            self.fake_build, local_build, module, version, FakeVcs())

        self.assertEqual(test_message, expected_message)
Example #11
0
    def test_given_local_test_build_possible_then_returned_string_begins_with_specific_string(
            self):

        local_build = False
        module, version = 'test', '1-2-3'
        expected_message = "Performing test build on local system"

        test_message, test_fail = dls_release.perform_test_build(
            self.fake_build, local_build, module, version, FakeVcs())

        self.assertTrue(
            test_message.startswith(expected_message),
            "returned message does not start with expected string")
Example #12
0
    def test_given_local_test_build_not_possible_when_called_then_return_specific_string(
            self):

        local_build = False
        module, version = 'test', '1-2-3'
        self.fake_build.local_test_possible = MagicMock(return_value=False)
        expected_message = "Local test build not possible since local system "
        expected_message += "not the same OS as build server"

        test_message, test_fail = dls_release.perform_test_build(
            self.fake_build, local_build, module, version, FakeVcs())

        self.assertEqual(test_message, expected_message)
Example #13
0
    def test_given_test_possible_and_build_works_then_return_test_not_failed_and_message_ends_with_specific_string(self):

        local_build = False
        self.fake_build.test.return_value = 0
        expected_message_end = "Test build successful. Continuing with build"
        expected_message_end += " server submission"

        test_message, test_fail = dls_release.perform_test_build(
            self.fake_build, local_build, FakeVcs())

        self.assertFalse(test_fail)
        self.assertTrue(
            test_message.endswith(expected_message_end),
            "returned message does not end with expected string")
Example #14
0
    def test_given_test_possible_and_build_works_then_return_test_not_failed_and_message_ends_with_specific_string(
            self):

        local_build = False
        module, version = 'test', '1-2-3'
        self.fake_build.test.return_value = 0
        expected_message_end = "Test build successful. Continuing with build"
        expected_message_end += " server submission"

        test_message, test_fail = dls_release.perform_test_build(
            self.fake_build, local_build, module, version, FakeVcs())

        self.assertFalse(test_fail)
        self.assertTrue(test_message.endswith(expected_message_end),
                        "returned message does not end with expected string")