Logo Search packages:      
Sourcecode: ubuntuone-couch version File versions  Download package

def ubuntuone::tests::test_couch::QueryTestCase::test_request_400 (   self )
Test a full request on 400.

Definition at line 263 of file test_couch.py.

                              :
        """Test a full request on 400."""
        mock_get_oauth_credentials = self.mocker.replace(
            'ubuntuone.couch.auth.get_oauth_credentials')
        mock_get_oauth_credentials()
        self.mocker.result({
            u'token': TOKEN_KEY,
            u'token_secret': TOKEN_SECRET,
            u'consumer_key': CONSUMER_KEY,
            u'consumer_secret': CONSUMER_SECRET})
        mock_get_user_info = self.mocker.replace(
            'ubuntuone.couch.get_user_info')
        mock_get_user_info(
            'https://one.ubuntu.com/api/account/', consumer_key=CONSUMER_KEY,
            consumer_secret=CONSUMER_SECRET, access_token=TOKEN_KEY,
            token_secret=TOKEN_SECRET)
        self.mocker.result((
            1337, "https://couchdb.one.ubuntu.com/u/abc/def/1337"))
        Http = self.mocker.replace("httplib2.Http")  # pylint: disable=C0103
        http = Http()
        http.request(
            'https://couchdb.one.ubuntu.com/u%2Fabc%2Fdef%2F1337%2Fcontacts',
            method='GET', headers=ANY, body=None)
        self.mocker.result(({'status': '400'}, ''))
        self.mocker.replay()
        self.assertRaises(OAuthAuthenticationError, request, 'contacts')


Generated by  Doxygen 1.6.0   Back to index