def test_remove_existing_user(self): d = StubDataDriver() d.set_file_exists(True) d.set_text("a;a\nb;b\nc;c\n") p = Passwd(name="test.txt", driver=d) p.remove_user("b", "b") p.commit() self.assertEqual(d.get_text(), "a;a\nc;c\n")
def test_remove_existing_user_wrong_passwd(self): d = StubDataDriver() d.set_file_exists(True) d.set_text("a;a\nb;b\nc;c\n") p = Passwd(name="test.txt", driver=d) try: p.remove_user("b", "d") except RuntimeError: self.assertEqual(True, True) return self.assertEqual(True, False)