From 7cb825cedb0eb6c8ae89934147e7368efcddf07c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alban=20F=C3=A9ron?= Date: Sat, 23 Nov 2019 15:43:27 +0100 Subject: [PATCH] Update tests --- tests/base/test_cli.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/base/test_cli.py b/tests/base/test_cli.py index f0174d4..ad1e1b5 100644 --- a/tests/base/test_cli.py +++ b/tests/base/test_cli.py @@ -120,11 +120,31 @@ class CLITestCase(unittest.TestCase): def test_user_setadmin(self): self.__cli.onecmd("user add -p Alic3 alice") - self.__cli.onecmd("user setadmin alice") - self.__cli.onecmd("user setadmin bob") + self.__cli.onecmd("user setroles -A alice") + self.__cli.onecmd("user setroles -A bob") with db_session: self.assertTrue(User.get(name="alice").admin) + def test_user_unsetadmin(self): + self.__cli.onecmd("user add -p Alic3 alice") + self.__cli.onecmd("user setroles -A alice") + self.__cli.onecmd("user setroles -a alice") + with db_session: + self.assertFalse(User.get(name="alice").admin) + + def test_user_setjukebox(self): + self.__cli.onecmd("user add -p Alic3 alice") + self.__cli.onecmd("user setroles -J alice") + with db_session: + self.assertTrue(User.get(name="alice").jukebox) + + def test_user_unsetjukebox(self): + self.__cli.onecmd("user add -p Alic3 alice") + self.__cli.onecmd("user setroles -J alice") + self.__cli.onecmd("user setroles -j alice") + with db_session: + self.assertFalse(User.get(name="alice").jukebox) + def test_user_changepass(self): self.__cli.onecmd("user add -p Alic3 alice") self.__cli.onecmd("user changepass alice newpass")