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_add_new_user(self): d = StubDataDriver() d.set_file_exists(False) p = Passwd(name="test.txt", driver=d) p.add_user("admin", "admin") p.commit() self.assertEqual(d.get_text(), "admin;admin\n")