示例#1
0
    def test_should_not_delete_directory_because_directory_exist_but_has_content(self):
        dir_create(test_path)
        file_path = test_path + '/test_file.txt'
        file_save(File(file_path, 'Test content'), append=False)
        dir_delete(test_path, force=False)

        self.assertTrue(is_dir_exist(test_path))
        self.assertTrue(file_exist(file_path))
示例#2
0
    def test_should_delete_directory_with_success_with_content(self):
        dir_create(test_path)
        file_path = test_path + '/test_file.txt'
        file_save(File(file_path, 'Test content'), append=False)
        dir_delete(test_path, force=True)

        self.assertFalse(is_dir_exist(file_path))
        self.assertFalse(file_exist(file_path))
示例#3
0
    def test_should_file_save_create_new_file_if_not_exist(self):
        path = '/tmp/another_test_file'
        content = 'File created once not exist'
        delete_tmp_file(path)
        file_save(File(path, content))

        self.assertTrue(file_exist(path))
        self.assertEqual(file_load(path).content, content)
        delete_tmp_file(path)
示例#4
0
    def test_should_return_False_if_file_not_exist(self):
        result = file_exist(file_path)

        self.assertFalse(result)
示例#5
0
    def test_should_return_True_if_file_exist(self):
        path = create_tmp_file()
        result = file_exist(path)

        self.assertTrue(result)