예제 #1
0
 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
예제 #2
0
 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()
예제 #3
0
 def test_contains_fail(self):
     db = Fake("db").expects("execute").with_args(arg.contains("table foo"))
     db.execute("select into table notyourmama;")
     fudge.verify()
예제 #4
0
 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)")
예제 #5
0
 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")
예제 #6
0
 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();")
예제 #7
0
 def test_any_value(self):
     db = Fake("db").expects("execute").with_args(arg.any())
     db.execute("delete from foo where 1")
예제 #8
0
 def test_contains_fail(self):
     db = Fake("db").expects("execute").with_args(arg.contains("table foo"))
     db.execute("select into table notyourmama;")
     fudge.verify()
예제 #9
0
 def test_startswith_fail(self):
     db = Fake("db").expects("execute").with_args(arg.startswith("insert into"))
     db.execute("select from")
예제 #10
0
 def test_endswith_ok_uni(self):
     db = Fake("db").expects("execute").with_args(arg.endswith("Ivan Krsti\u0107"))
     db.execute("select Ivan Krsti\u0107")
예제 #11
0
 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()
예제 #12
0
 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)")
예제 #13
0
 def test_any_value(self):
     db = Fake("db").expects("execute").with_args(arg.any())
     db.execute("delete from foo where 1")
예제 #14
0
 def test_startswith_ok_uni(self):
     db = Fake("db").expects("execute").with_args(arg.startswith("Ivan_Krsti\u0107"))
     db.execute("Ivan_Krsti\u0107(); foo();")
예제 #15
0
 def test_startswith_fail(self):
     db = Fake("db").expects("execute").with_args(arg.startswith("insert into"))
     db.execute("select from")
예제 #16
0
 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