def test_add_surname(self): app = Application() with mock.patch.object(app, "add") as mockadd: app.run("cmd add NAME SURNAME 333 ") mockadd.assert_called_with("NAME SURNAME", "333")
def test_adding_contacts(name): app = Application() app.run(f"contacts add {name} 3456789") name = name.strip() if name: assert app._contacts == [(name, "3456789")] else: assert app._contacts == []
def test_invalid(self): app = Application() with pytest.raises(ValueError): app.run("contacts invalid")
def test_nocmd(self): app = Application() with pytest.raises(ValueError): app.run("nocmd")
def test_empty(self): app = Application() with pytest.raises(ValueError): app.run("")