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


Python api.flags4appversions函数代码示例

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


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

示例1: testOneNew

 def testOneNew(self):
     """One accepted signoff on the new appversion, none on the old.
     Old appversion comes back empty.
     """
     locale = Locale.objects.get(code='da')
     repo = self._setup(locale, None, Action.ACCEPTED)
     self.assertEqual(repo.changesets.count(), 2)
     self.assertTupleEqual(
         _actions4appversion(self.old_av, {locale.id}, None, 100),
         ({}, {locale.id}))
     a4av, not_found = _actions4appversion(self.new_av,
                                           {locale.id}, None, 100)
     self.assertEqual(not_found, set())
     self.assertListEqual(list(a4av.keys()), [locale.id])
     flag, action_id = list(a4av[locale.id].items())[0]
     self.assertEqual(flag, Action.ACCEPTED)
     self.assertEqual(
         Signoff.objects.get(action=action_id).locale_id,
         locale.id)
     avs = AppVersion.objects.all()
     flagdata = flags4appversions(avs)
     self.assertIn(self.old_av, flagdata)
     self.assertIn(self.new_av, flagdata)
     self.assertEqual(len(flagdata), 2)
     self.assertDictEqual(
         flagdata[self.new_av],
         {'da':
             ['fx1.1', {Action.ACCEPTED: self.actions[1].id}]})
     self.assertDictEqual(flagdata[self.old_av], {})
开发者ID:Pike,项目名称:elmo,代码行数:29,代码来源:test_api.py

示例2: testOneOld

 def testOneOld(self):
     """One locale signed off and accepted on old appversion,
     nothing new on new, thus falling back to the old one.
     """
     locale = Locale.objects.get(code='da')
     repo = self._setup(locale, Action.ACCEPTED, None)
     self.assertEqual(repo.changesets.count(), 2)
     flaglocs4av, not_found = _actions4appversion(self.old_av,
                                                  {locale.id},
                                                  None,
                                                  100)
     self.assertEqual(not_found, set())
     self.assertListEqual(list(flaglocs4av.keys()), [locale.id])
     flag, action_id = list(flaglocs4av[locale.id].items())[0]
     self.assertEqual(flag, Action.ACCEPTED)
     self.assertEqual(
         Signoff.objects.get(action=action_id).locale_id,
         locale.id)
     self.assertTupleEqual(
         _actions4appversion(self.new_av, {locale.id}, None, 100),
         ({}, {locale.id}))
     avs = AppVersion.objects.all()
     flagdata = flags4appversions(avs)
     self.assertIn(self.old_av, flagdata)
     self.assertIn(self.new_av, flagdata)
     self.assertEqual(len(flagdata), 2)
     self.assertDictEqual(
         flagdata[self.new_av],
         {'da':
             ['fx1.0', {Action.ACCEPTED: self.actions[1].id}]
          })
     self.assertDictEqual(flagdata[self.old_av], flagdata[self.new_av])
开发者ID:Pike,项目名称:elmo,代码行数:32,代码来源:test_api.py

示例3: confirm_ship_mstone

def confirm_ship_mstone(request):
    """Intermediate page when shipping a milestone.

    Gathers all data to verify when shipping.
    Ends up in ship_mstone if everything is fine.
    Redirects to milestones() in case of trouble.
    """
    if not request.GET.get('ms'):
        raise http.Http404("ms must be supplied")
    mstone = get_object_or_404(Milestone, code=request.GET['ms'])
    if mstone.status != Milestone.OPEN:
        return http.HttpResponseRedirect(reverse('shipping.views.milestones'))
    flags4loc = (flags4appversions(appversions={'id': mstone.appver.id})
                 [mstone.appver])

    pending_locs = []
    good = 0
    for loc, (real_av, flags) in flags4loc.iteritems():
        if real_av == mstone.appver.code and Action.PENDING in flags:
            # pending
            pending_locs.append(loc)
        if Action.ACCEPTED in flags:
            # good
            good += 1
    pending_locs.sort()
    return render(request, 'shipping/confirm-ship.html', {
                  'mstone': mstone,
                  'pending_locs': pending_locs,
                  'good': good,
                  'login_form_needs_reload': True,
                  'request': request,
                  })
开发者ID:physte3,项目名称:elmo,代码行数:32,代码来源:__init__.py

示例4: test_signoff_annotated_pushes

    def test_signoff_annotated_pushes(self):
        view = SignoffView()
        locale = Locale.objects.get(code='de')

        real_av, flags = (
            api.flags4appversions([self.av], locales=[locale.id])
            .get(self.av, {})
            .get(locale.code, [None, {}]))
        actions = list(Action.objects.filter(id__in=flags.values())
                       .select_related('signoff__push__repository', 'author'))
        fallback, = actions
        assert fallback.flag == Action.ACCEPTED, fallback.flag
        pushes_data = view.annotated_pushes(
            locale,
            self.av,
            actions=actions,
            flags=flags,
            fallback=fallback,
        )
        suggested_signoff = pushes_data['suggested_signoff']
        self.assertIsNone(suggested_signoff)
        pushes = pushes_data['pushes']
        changesets = [c for p in pushes for c in p['changes']]
        revisions = [x.revision for x in changesets]
        # only `de` changes in the right order
        self.assertListEqual(revisions, ['l10n de 0003', 'l10n de 0002'])
开发者ID:Pike,项目名称:elmo,代码行数:26,代码来源:test_signoff.py

示例5: testOneOld

 def testOneOld(self):
     """One locale signed off and accepted on old appversion,
     nothing new on new, thus falling back to the old one.
     """
     locale = Locale.objects.get(code='da')
     repo = self._setup(locale, Action.ACCEPTED, None)
     eq_(repo.changesets.count(), 2)
     flaglocs4av, not_found = _actions4appversion(self.old_av,
                                                  set([locale.id]),
                                                  100)
     eq_(not_found, set())
     eq_(flaglocs4av.keys(), [locale.id])
     flag, action_id = flaglocs4av[locale.id].items()[0]
     eq_(flag, Action.ACCEPTED)
     eq_(Signoff.objects.get(action=action_id).locale_id, locale.id)
     eq_(_actions4appversion(self.new_av, set([locale.id]), 100),
         ({}, set([locale.id])))
     flagdata = flags4appversions()
     ok_(self.old_av in flagdata)
     ok_(self.new_av in flagdata)
     eq_(len(flagdata), 2)
     eq_(flagdata[self.new_av], {'da':
         ['fx1.0', {Action.ACCEPTED: self.actions[1].id}]
         })
     eq_(flagdata[self.old_av], flagdata[self.new_av])
开发者ID:hwine,项目名称:elmo,代码行数:25,代码来源:test_api.py

示例6: _get_flags_and_actions

 def _get_flags_and_actions(self):
     __, flags = (api.flags4appversions([self.av],
         locales=[self.locale.id])
                       .get(self.av, {})
                       .get(self.locale.code, [None, {}]))
     actions = Action.objects.filter(id__in=flags.values())
     return flags, actions
开发者ID:Archaeopteryx,项目名称:elmo,代码行数:7,代码来源:test_signoff.py

示例7: test_signoff_annotated_pushes

    def test_signoff_annotated_pushes(self):
        view = SignoffView()
        locale = Locale.objects.get(code='de')

        real_av, flags = (api.flags4appversions(
            locales={'id': locale.id},
            appversions={'id': self.av.id})
                          .get(self.av, {})
                          .get(locale.code, [None, {}]))
        actions = list(Action.objects.filter(id__in=flags.values())
                       .select_related('signoff__push__repository', 'author'))
        fallback, = actions
        assert fallback.flag == Action.ACCEPTED, fallback.flag
        pushes, suggested_signoff = view.annotated_pushes(
            actions,
            flags,
            fallback,
            locale,
            self.av
        )
        eq_(suggested_signoff, None)
        changesets = [c for p in pushes for c in p['changes']]
        revisions = [x.revision for x in changesets]
        # only `de` changes in the right order
        eq_(revisions, [u'l10n de 0003', u'l10n de 0002'])
开发者ID:Web5design,项目名称:elmo,代码行数:25,代码来源:test_signoff.py

示例8: _get_flags_and_actions

 def _get_flags_and_actions(self):
     __, flags = (api.flags4appversions(
         locales=self._locale_search,
         appversions=self._appver_search)
                       .get(self.av, {})
                       .get(self.locale.code, [None, {}]))
     actions = Action.objects.filter(id__in=flags.values())
     return flags, actions
开发者ID:Web5design,项目名称:elmo,代码行数:8,代码来源:test_signoff.py

示例9: testOneOldObsoleted

 def testOneOldObsoleted(self):
     locale = Locale.objects.get(code='da')
     repo = self._setup(locale, Action.OBSOLETED, None)
     eq_(repo.changesets.count(), 2)
     flagdata = flags4appversions()
     ok_(self.old_av in flagdata)
     ok_(self.new_av in flagdata)
     eq_(len(flagdata), 2)
     eq_(flagdata[self.new_av], {})
     eq_(flagdata[self.old_av], {})
开发者ID:hwine,项目名称:elmo,代码行数:10,代码来源:test_api.py

示例10: test_getflags

 def test_getflags(self):
     """Test that the list returns the right flags."""
     flags = flags4appversions(appversions={"code": "fx1.0"})
     av = AppVersion.objects.get(code="fx1.0")
     eq_(flags, {av: {
         "pl": ["fx1.0", {Action.PENDING: 2}],
         "de": ["fx1.0", {Action.ACCEPTED: 3}],
         "fr": ["fx1.0", {Action.REJECTED: 5}],
         "da": ["fx1.0", {Action.ACCEPTED: 8,
                          Action.PENDING: 7}]
     }})
开发者ID:hwine,项目名称:elmo,代码行数:11,代码来源:test_api.py

示例11: testOneOldObsoleted

 def testOneOldObsoleted(self):
     locale = Locale.objects.get(code='da')
     repo = self._setup(locale, Action.OBSOLETED, None)
     self.assertEqual(repo.changesets.count(), 2)
     avs = AppVersion.objects.all()
     flagdata = flags4appversions(avs)
     self.assertIn(self.old_av, flagdata)
     self.assertIn(self.new_av, flagdata)
     self.assertEqual(len(flagdata), 2)
     self.assertDictEqual(flagdata[self.new_av], {})
     self.assertDictEqual(flagdata[self.old_av], {})
开发者ID:Pike,项目名称:elmo,代码行数:11,代码来源:test_api.py

示例12: test_getflags

 def test_getflags(self):
     """Test that the list returns the right flags."""
     av = AppVersion.objects.get(code="fx1.0")
     flags = flags4appversions([av], locales=list(range(1, 5)))
     self.assertDictEqual(flags, {av: {
         "pl": ["fx1.0", {Action.PENDING: 2}],
         "de": ["fx1.0", {Action.ACCEPTED: 3}],
         "fr": ["fx1.0", {Action.REJECTED: 5}],
         "da": ["fx1.0", {Action.ACCEPTED: 8,
                          Action.PENDING: 7}]
     }})
开发者ID:Pike,项目名称:elmo,代码行数:11,代码来源:test_api.py

示例13: testOneOldAndNewObsoleted

 def testOneOldAndNewObsoleted(self):
     locale = Locale.objects.get(code='da')
     repo = self._setup(locale, Action.ACCEPTED, Action.OBSOLETED)
     eq_(repo.changesets.count(), 3)
     flagdata = flags4appversions()
     ok_(self.old_av in flagdata)
     ok_(self.new_av in flagdata)
     eq_(len(flagdata), 2)
     eq_(flagdata[self.new_av], {})
     eq_(flagdata[self.old_av], {'da':
         ['fx1.0', {Action.ACCEPTED: self.actions[1].id}]
         })
开发者ID:hwine,项目名称:elmo,代码行数:12,代码来源:test_api.py

示例14: testEmpty

 def testEmpty(self):
     locale = Locale.objects.get(code='da')
     repo = self._setup(locale, None, None)
     eq_(repo.changesets.count(), 1)
     eq_(_actions4appversion(self.old_av, set([locale.id]), 100),
         ({}, set([locale.id])))
     eq_(_actions4appversion(self.new_av, set([locale.id]), 100),
         ({}, set([locale.id])))
     flagdata = flags4appversions()
     ok_(self.old_av in flagdata)
     ok_(self.new_av in flagdata)
     eq_(len(flagdata), 2)
     eq_(flagdata[self.new_av], {})
     eq_(flagdata[self.old_av], flagdata[self.new_av])
开发者ID:hwine,项目名称:elmo,代码行数:14,代码来源:test_api.py

示例15: testOneOldAndNew

 def testOneOldAndNew(self):
     locale = Locale.objects.get(code='da')
     repo = self._setup(locale, Action.ACCEPTED, Action.ACCEPTED)
     eq_(repo.changesets.count(), 3)
     avs = AppVersion.objects.all()
     flagdata = flags4appversions(avs)
     ok_(self.old_av in flagdata)
     ok_(self.new_av in flagdata)
     eq_(len(flagdata), 2)
     eq_(flagdata[self.new_av], {'da':
         ['fx1.1', {Action.ACCEPTED: self.actions[3].id}]
         })
     eq_(flagdata[self.old_av], {'da':
         ['fx1.0', {Action.ACCEPTED: self.actions[1].id}]
         })
开发者ID:flodolo,项目名称:elmo,代码行数:15,代码来源:test_api.py


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