def test_too_many_args(self): db = Fake("db").expects("execute").with_args(bind={'one':1}) db.execute("select foozilate()", bind={'one':1}) # unexpected statement arg
def test_contains_str(self): db = Fake("db").expects("execute").with_args(arg.contains("table foo")) db.execute("select into table foo;") db.execute("select * from table foo where bar = 1") fudge.verify()
def test_contains_fail(self): db = Fake("db").expects("execute").with_args(arg.contains("table foo")) db.execute("select into table notyourmama;") fudge.verify()
def test_endswith_ok(self): db = Fake("db").expects("execute").with_args(arg.endswith("values (1,2,3,4)")) db.execute("insert into foo values (1,2,3,4)")
def test_endswith_ok_uni(self): db = Fake("db").expects("execute").with_args(arg.endswith(u"Ivan Krsti\u0107")) db.execute(u"select Ivan Krsti\u0107")
def test_startswith_ok_uni(self): db = Fake("db").expects("execute").with_args(arg.startswith(u"Ivan_Krsti\u0107")) db.execute(u"Ivan_Krsti\u0107(); foo();")
def test_any_value(self): db = Fake("db").expects("execute").with_args(arg.any()) db.execute("delete from foo where 1")
def test_startswith_fail(self): db = Fake("db").expects("execute").with_args(arg.startswith("insert into")) db.execute("select from")
def test_endswith_ok_uni(self): db = Fake("db").expects("execute").with_args(arg.endswith("Ivan Krsti\u0107")) db.execute("select Ivan Krsti\u0107")
def test_startswith_ok_uni(self): db = Fake("db").expects("execute").with_args(arg.startswith("Ivan_Krsti\u0107")) db.execute("Ivan_Krsti\u0107(); foo();")
def test_too_many_args(self): db = Fake("db").expects("execute").with_args(bind={'one': 1}) db.execute("select foozilate()", bind={'one': 1}) # unexpected statement arg