how to use pymock with webtest (http://webtest.pythonpaste.org/en/latest/index.html)

11 views
Skip to first unread message

myusern...@gmail.com

unread,
Sep 17, 2012, 11:22:18 PM9/17/12
to mox-d...@googlegroups.com
#new_api.py 

def test():
     return 'test'

----------------------------

#api_controller.py

@expose()
def test_controller(self):
        
        m = mox.Mox()

        m.StubOutWithMock(new_api, 'test')   
        new_api .test(user_id = 2).AndReturn( self.mydata )
 
        m.ReplayAll()
        
        ret = self.app.get( '/api/test' ) 
   
        self.assertTrue( ret.body == 'test' )
 
        m.UnsetStubs()
        m.VerifyAll()

when I run  nosetests 
it not mock def new_api .test   

please help me fix this , thank you very much


Reply all
Reply to author
Forward
0 new messages