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

def ubuntuone::tests::test_couch::QueryTestCase::test_request_all_dbs (   self )
Test a full request to _all_dbs.

Definition at line 193 of file test_couch.py.

                                  :
        """Test a full request to _all_dbs."""
        fake_result = [
            u'u/abc/def/1337/dc_trash', u'u/abc/def/1337/lernid',
            u'u/abc/def/1337/test_suite_db']
        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/_all_dbs?user_id=1337',
            method='GET', headers=ANY, body=None)
        self.mocker.result(({'status': '200'}, fake_json))
        self.mocker.replay()
        result = request('_all_dbs')
        self.assertEquals(fake_result, result)


Generated by  Doxygen 1.6.0   Back to index