From 7394427df001bc8ca1712cd58d12372e737dcb70 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Mon, 9 Nov 2020 15:14:33 +0530 Subject: [PATCH] test: Add tests for bench list-apps --- frappe/tests/test_commands.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/frappe/tests/test_commands.py b/frappe/tests/test_commands.py index 4e02de795a..9757a823a6 100644 --- a/frappe/tests/test_commands.py +++ b/frappe/tests/test_commands.py @@ -143,5 +143,24 @@ class TestCommands(BaseTestCommands): # test 1: remove app from installed_apps global default self.execute("bench --site {site} remove-from-installed-apps {app}", {"app": app}) + self.assertEquals(self.returncode, 0) self.execute("bench --site {site} list-apps") self.assertNotIn(app, self.stdout) + + def test_list_apps(self): + # test 1: sanity check for command + self.execute("bench --site all list-apps") + self.assertEquals(self.returncode, 0) + + # test 2: bare functionality for single site + self.execute("bench --site {site} list-apps") + self.assertEquals(self.returncode, 0) + list_apps = set([ + _x.split()[0] for _x in self.stdout.split("\n") + ]) + doctype = frappe.get_single("Installed Applications").installed_applications + if doctype: + installed_apps = set([x.app_name for x in doctype]) + else: + installed_apps = set(frappe.get_installed_apps()) + self.assertSetEqual(list_apps, installed_apps)