def test_that_check_custom_protocol_times_should_return_error_if_custom_protocol_times_setting_is_missing(
            self):
        del settings.CUSTOM_PROTOCOL_TIMES
        errors = check_custom_protocol_times()

        self.assertEqual([create_error_31_custom_protocol_times_is_not_set()],
                         errors)
Example #2
0
    def test_that_check_custom_protocol_times_should_return_error_if_custom_protocol_times_setting_is_not_bool_value(self):
        for wrong_value in [
            None,
            'a',
            1,
        ]:
            settings.CUSTOM_PROTOCOL_TIMES = wrong_value

            errors = check_custom_protocol_times()

            self.assertEqual([create_error_32_custom_protocol_times_has_wrong_value()], errors)
    def test_that_check_custom_protocol_times_should_return_error_if_custom_protocol_times_setting_does_not_match_golem_messages_constant(
            self):
        class CMT:
            def total_seconds(self):
                return 2

        class FAT:
            def total_seconds(self):
                return 2

        with mock.patch('concent_api.system_check.constants.CMT',
                        new_callable=CMT):
            with mock.patch('concent_api.system_check.constants.FAT',
                            new_callable=FAT):
                errors = check_custom_protocol_times()

        self.assertEqual([
            create_error_33_custom_protocol_times_is_false_and_settings_does_not_match_golem_messages_constants(
                'CONCENT_MESSAGING_TIME'),
            create_error_33_custom_protocol_times_is_false_and_settings_does_not_match_golem_messages_constants(
                'FORCE_ACCEPTANCE_TIME')
        ], errors)
Example #4
0
    def test_that_check_custom_protocol_times_should_not_return_error_if_settings_match_golem_messages_constants(self):
        errors = check_custom_protocol_times()

        self.assertEqual(errors, [])