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_adding_existing_user_does_not_raise_exception(self): try: add_user("already-present") add_user("already-present") except SudoError as ex: self.fail("Repeated user addition resulted in an unexpected return code")
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")