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

def ubuntuone::tests::test_couch::QueryTestCase::test_request_plaintext (   self )
Test a full request with PLAINTEXT.

Definition at line 153 of file test_couch.py.

                                    :
        """Test a full request with PLAINTEXT."""
        fake_result = {
            'committed_update_seq': 654,
            'compact_running': False,
            'db_name': 'u/abc/def/1337/contacts',
            'disk_format_version': 5,
            'disk_size': 929892,
            'doc_count': 626,
            'doc_del_count': 1,
            'instance_start_time': '1297965776474824',
            'purge_seq': 0,
            'update_seq': 654}
        fake_json = json.dumps(fake_result)
        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': '200'}, fake_json))
        self.mocker.replay()
        result = request('contacts', sig_meth='PLAINTEXT')
        self.assertEquals(fake_result, result)


Generated by  Doxygen 1.6.0   Back to index