Exemple #1
0
    def setUp(self):
        WebauthTestCase.setUp(self)

        # mock service for testing
        service = OflyService(
                'example',
                consumer_key='123',
                consumer_secret='456',
                authorize_url='http://example.com/authorize')
        self.service = service

        def raise_for_status():
            raise Exception('Response not OK!')

        self.raise_for_status = raise_for_status

        # mock response for testing
        response = Mock()
        response.content = 'access_token=321'
        response.ok = True
        response.status_code = 200
        response.raise_for_status = lambda: None
        self.response = response
Exemple #2
0
    def setUp(self):
        WebauthTestCase.setUp(self)

        # mock service for testing
        service = OAuth1Service(
                'example',
                consumer_key='123',
                consumer_secret='456',
                request_token_url='http://example.com/request_token',
                access_token_url='http://example.com/access_token',
                authorize_url='http://example.com/authorize')
        self.service = service

        def raise_for_status(*args, **kwargs):
            raise Exception('Response not OK!')

        self.raise_for_status = raise_for_status

        # mock response for testing
        response = Mock()
        response.content = 'oauth_token=123&oauth_token_secret=456'
        response.ok = True
        response.raise_for_status = lambda: None
        self.response = response