Esempio n. 1
0
    def test_put_friend(self):
        request, response = new_mock_request_response(self.m)
        self.m.StubOutWithMock(TwitterConnector, "new_api")

        api = _create_api(self.m)
        TwitterConnector.new_api().AndReturn(api)

        username = "******"
        api.CreateFriendship(username)
        response.set_status(204)

        handler = TwitterFriendHandler()
        handler.initialize(request, response)
        set_api_user(self.m)

        self.m.ReplayAll()
        handler.put(username)
        self.m.VerifyAll()
Esempio n. 2
0
 def test_put_friend(self):
     request, response = new_mock_request_response(self.m)
     self.m.StubOutWithMock(TwitterConnector, "new_api")
     
     api = _create_api(self.m)
     TwitterConnector.new_api().AndReturn(api)
     
     username = "******"
     api.CreateFriendship(username)
     response.set_status(204)
     
     handler = TwitterFriendHandler()
     handler.initialize(request, response)
     set_api_user(self.m)        
     
     self.m.ReplayAll()
     handler.put(username)
     self.m.VerifyAll()
Esempio n. 3
0
 def test_put_friend(self):
     request, response = new_mock_request_response(self.m)
     self.m.StubOutWithMock(TwitterConnector, "new_api")
     
     api = _create_api(self.m)
     TwitterConnector.new_api().AndReturn(api)
     
     username = "******"
     api.GetUser(username).AndReturn(Mock(name="hi", screen_name=username, 
         url="hi", statuses_count=1,
         followers_count=1, friends_count=1))
     
     handler = TwitterUserHandler()
     handler.initialize(request, response)
     set_api_user(self.m)        
     
     self.m.ReplayAll()
     handler.get(username)
     self.m.VerifyAll()
Esempio n. 4
0
    def test_put_friend(self):
        request, response = new_mock_request_response(self.m)
        self.m.StubOutWithMock(TwitterConnector, "new_api")

        api = _create_api(self.m)
        TwitterConnector.new_api().AndReturn(api)

        username = "******"
        api.GetUser(username).AndReturn(
            Mock(name="hi",
                 screen_name=username,
                 url="hi",
                 statuses_count=1,
                 followers_count=1,
                 friends_count=1))

        handler = TwitterUserHandler()
        handler.initialize(request, response)
        set_api_user(self.m)

        self.m.ReplayAll()
        handler.get(username)
        self.m.VerifyAll()