Exemplo n.º 1
0
    def test_check_if_dir_exists_returns_false_path_is_none(self, mock_exists, mock_isdir):
        # arrange
        dir_path = None

        # act
        result = Utils.check_if_directory_exists(dir_path)

        # assert
        mock_exists.assert_not_called()
        mock_isdir.assert_not_called()
        self.assertFalse(result)
Exemplo n.º 2
0
    def test_check_if_dir_exists_returns_false_if_exists_returns_false(self,
                                                                       mock_exists, mock_isdir):
        # arrange
        dir_path = 'blah'
        mock_exists.return_value = False

        # act
        result = Utils.check_if_directory_exists(dir_path)

        # assert
        mock_exists.assert_called_with(dir_path)
        mock_isdir.assert_not_called()
        self.assertFalse(result)
Exemplo n.º 3
0
    def test_check_if_dir_exists_returns_true(self, mock_exists, mock_isdir):
        # arrange #1
        dir_path = 'blah'
        mock_exists.return_value = True
        mock_isdir.return_value = True

        # act
        result = Utils.check_if_directory_exists(dir_path)

        # assert
        mock_exists.assert_called_with(dir_path)
        mock_isdir.assert_called_with(dir_path)
        self.assertTrue(result)