当前位置: 首页>>代码示例>>Python>>正文


Python base.list_url函数代码示例

本文整理汇总了Python中mkt.api.base.list_url函数的典型用法代码示例。如果您正苦于以下问题:Python list_url函数的具体用法?Python list_url怎么用?Python list_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了list_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_signup

 def test_signup(self, subscribe):
     res = self.client.post(list_url('newsletter'))
     eq_(res.status_code, 400)
     res = self.client.post(list_url('newsletter'),
                            data=json.dumps({'email': '[email protected]'}))
     eq_(res.status_code, 204)
     subscribe.assert_called_with(
         '[email protected]', 'marketplace', lang='en-US', country='us',
         trigger_welcome='Y', optin='Y', format='H')
开发者ID:KryDos,项目名称:zamboni,代码行数:9,代码来源:test_api.py

示例2: test_delete

    def test_delete(self, client):
        rdel = self.client.delete(get_url('account', self.account.pk))
        eq_(rdel.status_code, 204)

        client.api.bango.package().get.return_value = {"full": payment_data}
        rget = self.client.get(list_url('account'))
        eq_(json.loads(rget.content)['objects'], [])
开发者ID:KryDos,项目名称:zamboni,代码行数:7,代码来源:test_api.py

示例3: setUp

 def setUp(self):
     self.create_switch('search-api-es')
     self.create_switch('buchets')
     self.client = OAuthClient(None)
     self.url = list_url('search')
     self.webapp = Webapp.objects.get(pk=337141)
     self.category = Category.objects.create(name='test',
                                             type=amo.ADDON_WEBAPP)
     # A typical desktop profile on Firefox with the following features:
     # {'apps': True,
     #  'audio': True,
     #  'battery': True,
     #  'device_storage': True,
     #  'fullscreen': True,
     #  'geolocation': True,
     #  'idle': True,
     #  'indexeddb': True,
     #  'light_events': True,
     #  'network_info': True,
     #  'orientation': True,
     #  'proximity': True,
     #  'push': True,
     #  'sms': True,
     #  'vibrate': True,
     #  'video_webm': True,
     #  'webaudio': True}
     self.profile = '8a7dd46c.32.1'
     self.qs = {'q': 'something', 'pro': self.profile, 'dev': 'firefoxos'}
开发者ID:MikeLing,项目名称:zamboni,代码行数:28,代码来源:test_api.py

示例4: setUp

 def setUp(self):
     super(TestAccount, self).setUp(api_name='reviewers')
     self.list_url = list_url('reviewing')
     self.anon = OAuthClient(None, api_name='reviewers')
     self.user = UserProfile.objects.get(pk=2519)
     self.req = RequestFactory().get('/')
     self.req.amo_user = self.user
开发者ID:chenzihui,项目名称:zamboni,代码行数:7,代码来源:test_api.py

示例5: setUp

    def setUp(self):
        super(TestFeaturedHomeHandler, self).setUp(api_name='home')
        self.list_url = list_url('featured')
        self.cat = Category.objects.create(name='awesome',
                                           type=amo.ADDON_WEBAPP,
                                           slug='awesome')

        # App, no category, worldwide region.
        self.app1 = Webapp.objects.create(status=amo.STATUS_PUBLIC,
                                          name='App 1')
        f1 = FeaturedApp.objects.create(app=self.app1, category=None)
        FeaturedAppRegion.objects.create(featured_app=f1,
                                         region=mkt.regions.WORLDWIDE.id)

        # App, with category, worldwide region. Mostly to ensure category
        # specific featured apps don't slip into the results.
        self.app2 = Webapp.objects.create(status=amo.STATUS_PUBLIC,
                                          name='App 2')
        AddonCategory.objects.create(category=self.cat, addon=self.app2)
        f2 = FeaturedApp.objects.create(app=self.app2, category=self.cat)
        FeaturedAppRegion.objects.create(featured_app=f2,
                                         region=mkt.regions.WORLDWIDE.id)

        # App, no category, US region.
        self.app3 = Webapp.objects.create(status=amo.STATUS_PUBLIC,
                                          name='App 3')
        f3 = FeaturedApp.objects.create(app=self.app3)
        FeaturedAppRegion.objects.create(featured_app=f3,
                                         region=mkt.regions.US.id)
开发者ID:jvillalobos,项目名称:zamboni,代码行数:29,代码来源:test_api.py

示例6: setUp

 def setUp(self):
     super(TestGlobalStatsResource, self).setUp('stats')
     self.list_url = list_url('global')
     self.get_url = self.get_detail_url('global', STATS.keys()[0])
     self.create_switch('stats-api')
     self.data = {'start': '2013-04-01',
                  'end': '2013-04-15',
                  'interval': 'day'}
开发者ID:KryDos,项目名称:zamboni,代码行数:8,代码来源:test_api.py

示例7: test_add_fail

 def test_add_fail(self, client):
     err = {'broken': True}
     client.api.bango.package.post.side_effect = HttpClientError(
         content=err)
     r = self.client.post(list_url('account'),
                          data=json.dumps(payment_data))
     eq_(r.status_code, 500)
     eq_(json.loads(r.content), err)
开发者ID:magopian,项目名称:zamboni,代码行数:8,代码来源:test_api.py

示例8: setUp

 def setUp(self):
     self.create_switch('soft_delete')
     self.client = OAuthClient(None)
     self.url = list_url('search')
     self.webapp = Webapp.objects.get(pk=337141)
     self.category = Category.objects.create(name='test', slug='test',
                                             type=amo.ADDON_WEBAPP)
     self.webapp.save()
     self.refresh('webapp')
开发者ID:at13,项目名称:zamboni,代码行数:9,代码来源:test_api.py

示例9: setUp

    def setUp(self):
        super(TestPrices, self).setUp(api_name='webpay')
        self.price = Price.objects.create(name='1', price=Decimal(1))
        self.currency = self.make_currency(3, self.price, 'CAD')
        self.list_url = list_url('prices')
        self.get_url = get_url('prices', self.price.pk)

        # If regions change, this will blow up.
        assert regions.BR.default_currency == 'BRL'
开发者ID:MikeLing,项目名称:zamboni,代码行数:9,代码来源:test_resources.py

示例10: test_add

 def test_add(self, client):
     r = self.client.post(list_url('account'),
                          data=json.dumps(payment_data))
     eq_(r.status_code, 201)
     pa = PaymentAccount.objects.get(name='account')
     eq_(pa.user.pk, self.user.pk)
     d = client.api.bango.package.post.call_args[1]['data']
     for k, v in d.iteritems():
         if k not in ['paypalEmailAddress', 'seller']:
             eq_(payment_data[k], v)
开发者ID:magopian,项目名称:zamboni,代码行数:10,代码来源:test_api.py

示例11: setUp

 def setUp(self):
     self.client = OAuthClient(None)
     self.url = list_url('search')
     self.webapp = Webapp.objects.get(pk=337141)
     self.category = Category.objects.create(name='test',
                                             type=amo.ADDON_WEBAPP)
     # Pick a few common device features.
     self.profile = FeatureProfile(apps=True, audio=True, fullscreen=True,
                                   geolocation=True, indexeddb=True,
                                   sms=True).to_signature()
     self.qs = {'q': 'something', 'pro': self.profile, 'dev': 'firefoxos'}
开发者ID:chenliu0831,项目名称:zamboni,代码行数:11,代码来源:test_api.py

示例12: test_get_list

    def test_get_list(self, client):
        client.api.bango.package().get.return_value = {"full": payment_data}

        app2 = app_factory(premium_type=amo.ADDON_FREE_INAPP)
        AddonUser.objects.create(addon=app2, user=self.other)
        setup_payment_account(app2, self.other)

        r = self.client.get(list_url('account'))
        eq_(r.status_code, 200)
        data = json.loads(r.content)
        pkg = package_data.copy()
        pkg['resource_uri'] = '/api/v1/payments/account/%s/' % self.account.pk
        eq_(data['objects'], [pkg])
开发者ID:magopian,项目名称:zamboni,代码行数:13,代码来源:test_api.py

示例13: _create

 def _create(self, data=None):
     default_data = {
         'app': self.app.id,
         'body': 'Rocking the free web.',
         'rating': 5
     }
     if data:
         default_data.update(data)
     json_data = json.dumps(default_data)
     res = self.client.post(list_url('rating'), data=json_data)
     try:
         res_data = json.loads(res.content)
     except ValueError:
         res_data = res.content
     return res, res_data
开发者ID:sandy-slin,项目名称:zamboni,代码行数:15,代码来源:test_resources.py

示例14: setUp

 def setUp(self):
     super(TestFeedbackHandler, self).setUp(api_name='account')
     self.list_url = list_url('feedback')
     self.user = UserProfile.objects.get(pk=2519)
     self.default_data = {
         'chromeless': 'no',
         'feedback': 'Here is what I really think.',
         'platform': 'Desktop',
         'from_url': '/feedback',
         'sprout': 'potato'
     }
     self.headers = {
         'HTTP_USER_AGENT': 'Fiiia-fox',
         'REMOTE_ADDR': '48.151.623.42'
     }
开发者ID:KryDos,项目名称:zamboni,代码行数:15,代码来源:test_api.py

示例15: setUp

    def setUp(self, api_name="reviewers"):
        super(TestApiReviewer, self).setUp(api_name=api_name)
        self.user = User.objects.get(pk=2519)
        self.profile = self.user.get_profile()
        self.profile.update(read_dev_agreement=datetime.now())
        self.grant_permission(self.profile, "Apps:Review")

        self.access = Access.objects.create(key="test_oauth_key", secret=generate(), user=self.user)
        self.client = OAuthClient(self.access, api_name=api_name)
        self.url = list_url("search")

        self.webapp = Webapp.objects.get(pk=337141)
        self.category = Category.objects.create(name="test", type=amo.ADDON_WEBAPP)

        self.webapp.update(status=amo.STATUS_PENDING)
        self.refresh("webapp")
开发者ID:pombredanne,项目名称:zamboni,代码行数:16,代码来源:test_api.py


注:本文中的mkt.api.base.list_url函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。