1 Star 0 Fork 107

yanan-rock/anaconda

forked from src-openEuler/anaconda 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
bugfix-add-tests-for-verify-valid-installtree-function.patch 2.26 KB
一键复制 编辑 原始数据 按行查看 历史
zhuqingfu 提交于 2020-09-17 11:22 . do not require treeinfo
From 5dc9b2ee4dde7b6deb477b581759c5f76dcb87b5 Mon Sep 17 00:00:00 2001
From: Jiri Konecny <[email protected]>
Date: Fri, 19 Jun 2020 15:57:57 +0200
Subject: [PATCH] Add tests for verify_valid_installtree function (#1844287)
It's testing if repodata/repomd.xml file exists.
Related: rhbz#1844287
Related: rhbz#1849093
---
.../module_source_base_test.py | 23 ++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/tests/nosetests/pyanaconda_tests/module_source_base_test.py b/tests/nosetests/pyanaconda_tests/module_source_base_test.py
index f58e2b1639..3ba40edf4c 100644
--- a/tests/nosetests/pyanaconda_tests/module_source_base_test.py
+++ b/tests/nosetests/pyanaconda_tests/module_source_base_test.py
@@ -16,6 +16,8 @@
# Red Hat, Inc.
#
import unittest
+from pathlib import Path
+from tempfile import TemporaryDirectory
from unittest.mock import patch
from pyanaconda.core.constants import INSTALL_TREE
@@ -23,7 +25,8 @@
from pyanaconda.modules.payloads.constants import SourceType
from pyanaconda.modules.payloads.source.mount_tasks import SetUpMountTask, TearDownMountTask
from pyanaconda.modules.payloads.source.source_base import MountingSourceMixin
-from pyanaconda.modules.payloads.source.utils import find_and_mount_iso_image
+from pyanaconda.modules.payloads.source.utils import find_and_mount_iso_image, \
+ verify_valid_installtree
mount_location = "/some/dir"
@@ -184,3 +187,21 @@ def find_and_mount_iso_image_fail_mount_test(self,
)
self.assertEqual(iso_name, "")
+
+ def verify_valid_installtree_success_test(self):
+ """Test verify_valid_installtree functionality success."""
+ with TemporaryDirectory() as tmp:
+ repodir_path = Path(tmp, "repodata")
+ repodir_path.mkdir()
+ repomd_path = Path(repodir_path, "repomd.xml")
+ repomd_path.write_text("This is a cool repomd file!")
+
+ self.assertTrue(verify_valid_installtree(tmp))
+
+ def verify_valid_installtree_failed_test(self):
+ """Test verify_valid_installtree functionality failed."""
+ with TemporaryDirectory() as tmp:
+ repodir_path = Path(tmp, "repodata")
+ repodir_path.mkdir()
+
+ self.assertFalse(verify_valid_installtree(tmp))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yanan-rock/anaconda.git
[email protected]:yanan-rock/anaconda.git
yanan-rock
anaconda
anaconda
master

搜索帮助