本文整理汇总了Python中shipping.api.flags4appversions函数的典型用法代码示例。如果您正苦于以下问题:Python flags4appversions函数的具体用法?Python flags4appversions怎么用?Python flags4appversions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了flags4appversions函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: testOneOldAndNewObsoleted
def testOneOldAndNewObsoleted(self):
locale = Locale.objects.get(code='da')
repo = self._setup(locale, Action.ACCEPTED, Action.OBSOLETED)
self.assertEqual(repo.changesets.count(), 3)
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],
{'da':
['fx1.0', {Action.ACCEPTED: self.actions[1].id}]
})
开发者ID:Pike,项目名称:elmo,代码行数:15,代码来源:test_api.py
示例17: testOneOldAndOtherNew
def testOneOldAndOtherNew(self):
da = Locale.objects.get(code='da')
de = Locale.objects.get(code='de')
repo = self._setup(da, Action.ACCEPTED, None)
eq_(repo.changesets.count(), 2)
repo = self._setup(de, None, Action.ACCEPTED)
eq_(repo.changesets.count(), 2)
a4av, not_found = _actions4appversion(self.old_av,
{da.id, de.id}, None, 100)
eq_(not_found, {de.id})
eq_(a4av.keys(), [da.id])
flag, action_id = a4av[da.id].items()[0]
eq_(flag, Action.ACCEPTED)
a4av, not_found = _actions4appversion(self.new_av,
{da.id, de.id}, None, 100)
eq_(not_found, {da.id})
eq_(a4av.keys(), [de.id])
flag, action_id = a4av[de.id].items()[0]
eq_(flag, Action.ACCEPTED)
a4av, not_found = _actions4appversion(self.old_av,
{da.id, de.id}, None, 100)
eq_(not_found, {de.id})
eq_(a4av.keys(), [da.id])
flag, action_id = a4av[da.id].items()[0]
eq_(flag, Action.ACCEPTED)
a4avs = actions4appversions(appversions=[self.new_av],
locales=[da.id, de.id])
eq_(len(a4avs), 2)
ok_(self.old_av in a4avs)
ok_(self.new_av in a4avs)
a4av = a4avs[self.new_av]
eq_(len(a4av), 1)
a4av = a4avs[self.old_av]
eq_(len(a4av), 1)
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.0', {Action.ACCEPTED: self.actions[1].id}],
'de': ['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,代码行数:46,代码来源:test_api.py
示例18: testEmpty
def testEmpty(self):
locale = Locale.objects.get(code='da')
repo = self._setup(locale, None, None)
self.assertEqual(repo.changesets.count(), 1)
self.assertTupleEqual(
_actions4appversion(self.old_av, {locale.id}, None, 100),
({}, {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], {})
self.assertDictEqual(flagdata[self.old_av], flagdata[self.new_av])
开发者ID:Pike,项目名称:elmo,代码行数:17,代码来源:test_api.py
示例19: testOneOldAndOtherNew
def testOneOldAndOtherNew(self):
da = Locale.objects.get(code='da')
de = Locale.objects.get(code='de')
repo = self._setup(da, Action.ACCEPTED, None)
self.assertEqual(repo.changesets.count(), 2)
repo = self._setup(de, None, Action.ACCEPTED)
self.assertEqual(repo.changesets.count(), 2)
a4av, not_found = _actions4appversion(self.old_av,
{da.id, de.id}, None, 100)
self.assertSetEqual(not_found, {de.id})
self.assertListEqual(list(a4av.keys()), [da.id])
flag, action_id = list(a4av[da.id].items())[0]
self.assertEqual(flag, Action.ACCEPTED)
a4av, not_found = _actions4appversion(self.new_av,
{da.id, de.id}, None, 100)
self.assertSetEqual(not_found, {da.id})
self.assertListEqual(list(a4av.keys()), [de.id])
flag, action_id = list(a4av[de.id].items())[0]
self.assertEqual(flag, Action.ACCEPTED)
a4av, not_found = _actions4appversion(self.old_av,
{da.id, de.id}, None, 100)
self.assertSetEqual(not_found, {de.id})
self.assertListEqual(list(a4av.keys()), [da.id])
flag, action_id = list(a4av[da.id].items())[0]
self.assertEqual(flag, Action.ACCEPTED)
a4avs = actions4appversions(appversions=[self.new_av],
locales=[da.id, de.id])
self.assertEqual(len(a4avs), 2)
self.assertIn(self.old_av, a4avs)
self.assertIn(self.new_av, a4avs)
a4av = a4avs[self.new_av]
self.assertEqual(len(a4av), 1)
a4av = a4avs[self.old_av]
self.assertEqual(len(a4av), 1)
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}],
'de': ['fx1.1', {Action.ACCEPTED: self.actions[3].id}]
})
self.assertDictEqual(flagdata[self.old_av], {
'da': ['fx1.0', {Action.ACCEPTED: self.actions[1].id}]
})
开发者ID:Pike,项目名称:elmo,代码行数:46,代码来源:test_api.py
示例20: signoff
def signoff(request, locale_code, app_code):
"""View to show recent sign-offs and opportunities to sign off.
This view is the main entry point to localizers to add sign-offs and to
review what they're shipping.
It's also the entry point for drivers to review existing sign-offs.
"""
appver = get_object_or_404(AppVersion, code=app_code)
lang = get_object_or_404(Locale, code=locale_code)
# which pushes to show
real_av, flags = (flags4appversions(
locales={'id': lang.id},
appversions={'id': appver.id})
.get(appver, {})
.get(lang.code, [None, {}]))
actions = list(Action.objects.filter(id__in=flags.values())
.select_related('signoff__push__repository', 'author'))
# get current status of signoffs
push4action = dict((a.id, a.signoff.push)
for a in actions)
pending = push4action.get(flags.get(Action.PENDING))
rejected = push4action.get(flags.get(Action.REJECTED))
accepted = push4action.get(flags.get(Action.ACCEPTED))
if real_av != appver.code and accepted is not None:
# we're falling back, add the accepted push to the table
fallback = accepted
else:
fallback = None
pushes, suggested_signoff = annotated_pushes(appver, lang, actions, flags, fallback)
return render(request, 'shipping/signoffs.html', {
'appver': appver,
'language': lang,
'pushes': pushes,
'pending': pending,
'rejected': rejected,
'accepted': accepted,
'suggested_signoff': suggested_signoff,
'login_form_needs_reload': True,
'fallback': fallback,
'real_av': real_av,
})
开发者ID:hwine,项目名称:elmo,代码行数:44,代码来源:signoff.py
注:本文中的shipping.api.flags4appversions函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论