2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-09 08:30:39 +00:00

test: Use frappe_theme to test apps instead of erpnext

* Don't skip assets
This commit is contained in:
Gavin D'souza 2021-04-23 11:20:22 +05:30
parent f04a9e6e0d
commit 405f41e434
2 changed files with 12 additions and 13 deletions

View File

@ -90,7 +90,6 @@ class TestBenchBase(unittest.TestCase):
python=sys.executable,
no_procfile=True,
no_backups=True,
skip_assets=True,
frappe_path=frappe_tmp_path
))

View File

@ -97,7 +97,7 @@ class TestBenchInit(TestBenchBase):
def test_get_app(self):
self.init_bench("test-bench")
bench_path = os.path.join(self.benches_path, "test-bench")
bench.utils.exec_cmd("bench get-app frappe_theme --skip-assets", cwd=bench_path)
bench.utils.exec_cmd("bench get-app frappe_theme", cwd=bench_path)
self.assertTrue(os.path.exists(os.path.join(bench_path, "apps", "frappe_theme")))
app_installed_in_env = "frappe_theme" in subprocess.check_output(["bench", "pip", "freeze"], cwd=bench_path).decode('utf8')
self.assertTrue(app_installed_in_env)
@ -111,22 +111,22 @@ class TestBenchInit(TestBenchBase):
self.init_bench(bench_name)
bench.utils.exec_cmd("bench setup requirements --node", cwd=bench_path)
bench.utils.exec_cmd("bench build", cwd=bench_path)
bench.utils.exec_cmd("bench get-app erpnext --branch {0}".format(FRAPPE_BRANCH), cwd=bench_path)
bench.utils.exec_cmd("bench get-app frappe_theme --branch master", cwd=bench_path)
self.assertTrue(os.path.exists(os.path.join(bench_path, "apps", "erpnext")))
self.assertTrue(os.path.exists(os.path.join(bench_path, "apps", "frappe_theme")))
# check if app is installed
app_installed_in_env = "erpnext" in subprocess.check_output(["bench", "pip", "freeze"], cwd=bench_path).decode('utf8')
app_installed_in_env = "frappe_theme" in subprocess.check_output(["bench", "pip", "freeze"], cwd=bench_path).decode('utf8')
self.assertTrue(app_installed_in_env)
# create and install app on site
self.new_site(site_name, bench_name)
installed_erpnext = not bench.utils.exec_cmd("bench --site {0} install-app erpnext".format(site_name), cwd=bench_path)
installed_app = not bench.utils.exec_cmd("bench --site {0} install-app frappe_theme".format(site_name), cwd=bench_path)
app_installed_on_site = subprocess.check_output(["bench", "--site", site_name, "list-apps"], cwd=bench_path).decode('utf8')
if installed_erpnext:
self.assertTrue("erpnext" in app_installed_on_site)
if installed_app:
self.assertTrue("frappe_theme" in app_installed_on_site)
def test_remove_app(self):
@ -134,13 +134,13 @@ class TestBenchInit(TestBenchBase):
bench_path = os.path.join(self.benches_path, "test-bench")
bench.utils.exec_cmd("bench setup requirements --node", cwd=bench_path)
bench.utils.exec_cmd("bench get-app erpnext --branch version-12 --skip-assets --overwrite", cwd=bench_path)
bench.utils.exec_cmd("bench remove-app erpnext", cwd=bench_path)
bench.utils.exec_cmd("bench get-app frappe_theme --branch master --overwrite", cwd=bench_path)
bench.utils.exec_cmd("bench remove-app frappe_theme", cwd=bench_path)
with open(os.path.join(bench_path, "sites", "apps.txt")) as f:
self.assertFalse("erpnext" in f.read())
self.assertFalse("erpnext" in subprocess.check_output(["bench", "pip", "freeze"], cwd=bench_path).decode('utf8'))
self.assertFalse(os.path.exists(os.path.join(bench_path, "apps", "erpnext")))
self.assertFalse("frappe_theme" in f.read())
self.assertFalse("frappe_theme" in subprocess.check_output(["bench", "pip", "freeze"], cwd=bench_path).decode('utf8'))
self.assertFalse(os.path.exists(os.path.join(bench_path, "apps", "frappe_theme")))
def test_switch_to_branch(self):