def test_main_no_files(self, m_bashaterun, m_argv):
        m_run_obj = mock.MagicMock()
        m_run_obj.error_count = 0
        m_bashaterun.return_value = m_run_obj

        result = bashate.main()
        expected_return = 1
        self.assertEqual(expected_return, result)
Esempio n. 2
0
    def test_main_no_files(self, m_bashaterun, m_argv):
        m_run_obj = mock.MagicMock()
        m_run_obj.error_count = 0
        m_bashaterun.return_value = m_run_obj

        result = bashate.main()
        expected_return = 1
        self.assertEqual(expected_return, result)
Esempio n. 3
0
    def test_main_return_one_on_errors(self, m_bashaterun):
        m_run_obj = mock.MagicMock()
        m_run_obj.warning_count = 1
        m_run_obj.error_count = 1
        m_bashaterun.return_value = m_run_obj

        result = bashate.main([])
        expected_return = 1
        self.assertEqual(expected_return, result)
    def test_main_return_one_on_ioerror(self, m_bashaterun, m_argv):
        m_run_obj = mock.MagicMock()
        m_run_obj.error_count = 0
        m_run_obj.check_files = mock.Mock(side_effect=IOError)
        m_bashaterun.return_value = m_run_obj

        result = bashate.main()
        expected_return = 1
        self.assertEqual(expected_return, result)
Esempio n. 5
0
    def test_main_return_one_on_ioerror(self, m_bashaterun, m_argv):
        m_run_obj = mock.MagicMock()
        m_run_obj.error_count = 0
        m_run_obj.check_files = mock.Mock(side_effect=IOError)
        m_bashaterun.return_value = m_run_obj

        result = bashate.main()
        expected_return = 1
        self.assertEqual(expected_return, result)
Esempio n. 6
0
    def test_main_return_one_on_errors(self, m_bashaterun):
        m_run_obj = mock.MagicMock()
        m_run_obj.warning_count = 1
        m_run_obj.error_count = 1
        m_bashaterun.return_value = m_run_obj

        result = bashate.main([])
        expected_return = 1
        self.assertEqual(expected_return, result)
Esempio n. 7
0
    def test_main_return_one_on_ioerror(self, m_bashaterun):
        m_run_obj = mock.MagicMock()
        m_run_obj.error_count = 0
        m_run_obj.check_files = mock.Mock(side_effect=IOError)
        m_bashaterun.return_value = m_run_obj

        result = bashate.main(['--verbose',
                               '/path/to/fileA', '/path/to/fileB'])
        m_run_obj.check_files.assert_called_with(['/path/to/fileA',
                                                  '/path/to/fileB'], True)
        expected_return = 1
        self.assertEqual(expected_return, result)
Esempio n. 8
0
    def test_main_return_one_on_ioerror(self, m_bashaterun):
        m_run_obj = mock.MagicMock()
        m_run_obj.error_count = 0
        m_run_obj.check_files = mock.Mock(side_effect=IOError)
        m_bashaterun.return_value = m_run_obj

        result = bashate.main(['--verbose',
                               '/path/to/fileA', '/path/to/fileB'])
        m_run_obj.check_files.assert_called_with(['/path/to/fileA',
                                                  '/path/to/fileB'], True)
        expected_return = 1
        self.assertEqual(expected_return, result)
Esempio n. 9
0
    def test_main_return_one_on_errors(self, m_bashaterun, m_argparser):
        m_opts = mock.MagicMock()
        m_opts.files = 'not_a_file'
        m_parser_obj = mock.MagicMock()
        m_parser_obj.parse_args = mock.Mock(return_value=m_opts)
        m_argparser.return_value = m_parser_obj

        m_run_obj = mock.MagicMock()
        m_run_obj.ERRORS = 1
        m_bashaterun.return_value = m_run_obj

        result = bashate.main()
        expected_return = 1
        self.assertEqual(expected_return, result)
Esempio n. 10
0
    def test_main_no_files(self, m_bashaterun, m_argparser):
        m_opts = mock.MagicMock()
        m_opts.files = []
        m_parser_obj = mock.MagicMock()
        m_parser_obj.parse_args = mock.Mock(return_value=m_opts)
        m_argparser.return_value = m_parser_obj

        m_run_obj = mock.MagicMock()
        m_run_obj.ERRORS = 0
        m_bashaterun.return_value = m_run_obj

        result = bashate.main()

        m_parser_obj.print_usage.assert_called_once_with()
        expected_return = 1
        self.assertEqual(expected_return, result)