def test_removing_non_existant_user_does_not_raise_exception(self): try: remove_user("doesnt-exist") except SudoError as ex: self.fail("User removal triggered unexpected return code")
def test_can_add_user(self): remove_user("test-add-user") self.assert_file_doesnt_contain("/etc/passwd", "test-add-user") add_user("test-add-user") self.assert_file_contains("/etc/passwd", 1, "^test-add-user")
def test_can_remove_user(self): add_user("testingremoval") self.assert_file_contains("/etc/passwd", 1, "^testingremoval") remove_user("testingremoval") self.assert_file_doesnt_contain("/etc/passwd", "^testingremoval")