Exemple #1
0
    def test_check_if_file_exists_returns_false_path_is_none(self, mock_exists, mock_isfile):
        """ Test a valid invocation of API check_if_file_exists """

        # arrange
        file_path = None

        # act
        result = Utils.check_if_file_exists(file_path)

        # assert
        mock_exists.assert_not_called()
        mock_isfile.assert_not_called()
        self.assertFalse(result)
Exemple #2
0
    def test_check_if_file_exists_returns_true(self, mock_exists, mock_isfile):
        """ Test a valid invocation of API check_if_file_exists """
        # arrange #1
        file_path = 'blah'
        mock_exists.return_value = True
        mock_isfile.return_value = True

        # act
        result = Utils.check_if_file_exists(file_path)

        # assert
        mock_exists.assert_called_with(file_path)
        mock_isfile.assert_called_with(file_path)
        self.assertTrue(result)