def test_correct_set_value(self):
        model = PrimeNumberViewModel()
        model.set_start_value(1)
        model.set_end_value(10)

        self.assertEqual(1, model.get_start_value())
        self.assertEqual(10, model.get_end_value())
 def test_model_perform_logging(self):
     model = PrimeNumberViewModel()
     model.set_start_value(2)
     model.set_end_value(10)
     model.perform()
     self.assertEqual('Result = [2, 3, 5, 7]',
                      model.logger.get_last_message())
    def test_input_wrong_data(self):
        model = PrimeNumberViewModel()
        model.set_start_value(10)
        model.set_end_value(2)
        model.perform()

        wrong_message = 'Что-то пошло не так.\nВозможно первое число оказалось больше второго'
        self.assertEqual(wrong_message, model.logger.get_last_message())
    def test_model_perform_all_message_logging(self):
        model = PrimeNumberViewModel()
        model.set_start_value(2)
        model.set_end_value(10)
        model.perform()

        log_message = [
            'Welcome!', 'Setting start value - 2', 'Setting end value - 10',
            'Button clicked', 'Interval = range(2, 10)',
            'Result = [2, 3, 5, 7]'
        ]
        self.assertEqual(log_message, model.logger.get_log_messages()[-6:])
    def test_when_clear_first_number_button_disabled(self):
        model = PrimeNumberViewModel(1, 10)
        model.set_start_value(None)

        self.assertEqual('disabled', model.is_button_enable())
 def test_set_start_value_logging(self):
     model = PrimeNumberViewModel()
     model.set_start_value(2)
     self.assertEqual('Setting start value - 2',
                      model.logger.get_last_message())