Exemple #1
0
    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 == []
Exemple #3
0
    def test_invalid(self):
        app = Application()

        with pytest.raises(ValueError):
            app.run("contacts invalid")
Exemple #4
0
    def test_nocmd(self):
        app = Application()

        with pytest.raises(ValueError):
            app.run("nocmd")
Exemple #5
0
    def test_empty(self):
        app = Application()

        with pytest.raises(ValueError):
            app.run("")