本文整理汇总了Python中mkt.site.tests.user_factory函数的典型用法代码示例。如果您正苦于以下问题:Python user_factory函数的具体用法?Python user_factory怎么用?Python user_factory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_factory函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
self.app = mkt.site.tests.app_factory(status=mkt.STATUS_PENDING)
self.user = user_factory(email='editor')
self.grant_permission(self.user, 'Apps:Review')
self.admin_user = user_factory(email='admin')
self.grant_permission(self.admin_user, '*:*', name='Admins')
user_factory(email='regular')
开发者ID:psvramaraju,项目名称:zamboni,代码行数:7,代码来源:test_models.py
示例2: setUp
def setUp(self):
super(TestUserHasPermNoteApps, self).setUp()
self.app = app_factory()
self.developer = user_factory()
self.developer.addonuser_set.create(addon=self.app)
self.reviewer = user_factory()
self.grant_permission(self.reviewer, "Apps", "Review")
self.thread = CommunicationThread.objects.create(_addon=self.app, _version=self.app.latest_version)
开发者ID:ujdhesa,项目名称:zamboni,代码行数:8,代码来源:test_models.py
示例3: test_dev_total
def test_dev_total(self):
p1 = user_factory(source=mkt.LOGIN_SOURCE_MMO_BROWSERID)
p2 = user_factory(source=mkt.LOGIN_SOURCE_MMO_BROWSERID)
a1 = mkt.site.tests.app_factory()
AddonUser.objects.create(addon=a1, user=p1)
AddonUser.objects.create(addon=a1, user=p2)
eq_(tasks._get_monolith_jobs()
['mmo_developer_count_total'][0]['count'](), 2)
开发者ID:atiqueahmedziad,项目名称:zamboni,代码行数:9,代码来源:test_cron.py
示例4: setUp
def setUp(self):
self.developer = user_factory()
self.mozilla_contact = user_factory()
self.reviewer = user_factory()
self.senior_reviewer = user_factory()
self.grant_permission(self.senior_reviewer, '*:*',
'Senior App Reviewers')
self.app = app_factory()
self.app.addonuser_set.create(user=self.developer)
self.app.update(mozilla_contact=self.mozilla_contact.email)
开发者ID:atiqueahmedziad,项目名称:zamboni,代码行数:12,代码来源:test_utils_mail.py
示例5: test_escalate_on_prerelease_permissions
def test_escalate_on_prerelease_permissions(self):
"""Test that apps that use prerelease permissions are escalated."""
user_factory(email=settings.NOBODY_EMAIL_ADDRESS)
self.app.current_version.update(version='0.9',
created=self.days_ago(1))
ok_(not EscalationQueue.objects.filter(addon=self.app).exists(),
'App in escalation queue')
self._post(302)
version = self.app.versions.latest()
eq_(version.version, '1.0')
eq_(version.all_files[0].status, mkt.STATUS_PENDING)
self.app.update_status()
eq_(self.app.status, mkt.STATUS_PUBLIC)
ok_(EscalationQueue.objects.filter(addon=self.app).exists(),
'App not in escalation queue')
开发者ID:pkdevboxy,项目名称:zamboni,代码行数:15,代码来源:test_views_versions.py
示例6: test_rereview_flag_adult
def test_rereview_flag_adult(self):
mkt.set_user(user_factory())
app = app_factory()
app.set_content_ratings({
mkt.ratingsbodies.ESRB: mkt.ratingsbodies.ESRB_E,
mkt.ratingsbodies.CLASSIND: mkt.ratingsbodies.CLASSIND_18,
})
_flag_rereview_adult(app, mkt.ratingsbodies.ESRB,
mkt.ratingsbodies.ESRB_T)
assert not app.rereviewqueue_set.count()
assert not ActivityLog.objects.filter(
action=mkt.LOG.CONTENT_RATING_TO_ADULT.id).exists()
# Adult should get flagged to rereview.
_flag_rereview_adult(app, mkt.ratingsbodies.ESRB,
mkt.ratingsbodies.ESRB_A)
eq_(app.rereviewqueue_set.count(), 1)
eq_(ActivityLog.objects.filter(
action=mkt.LOG.CONTENT_RATING_TO_ADULT.id).count(), 1)
# Test things same same if rating stays the same as adult.
app.set_content_ratings({
mkt.ratingsbodies.ESRB: mkt.ratingsbodies.ESRB_A,
})
_flag_rereview_adult(app, mkt.ratingsbodies.ESRB,
mkt.ratingsbodies.ESRB_A)
eq_(app.rereviewqueue_set.count(), 1)
eq_(ActivityLog.objects.filter(
action=mkt.LOG.CONTENT_RATING_TO_ADULT.id).count(), 1)
开发者ID:shahbaz17,项目名称:zamboni,代码行数:30,代码来源:test_cron.py
示例7: setUp
def setUp(self):
self.app = app_factory(status=mkt.STATUS_PENDING)
self.version = self.app.latest_version
self.thread = CommunicationThread.objects.create(
_addon=self.app, _version=self.version)
self.user = user_factory()
self.app.addonuser_set.create(user=self.user)
开发者ID:atiqueahmedziad,项目名称:zamboni,代码行数:7,代码来源:test_commands.py
示例8: test_incorrect_user
def test_incorrect_user(self):
self.file.user = user_factory()
self.file.save()
form = forms.NewWebappForm({'upload': self.file.uuid},
request=self.request)
assert not form.is_valid()
eq_(form.ERRORS['user'], form.errors['upload'])
开发者ID:digideskio,项目名称:zamboni,代码行数:7,代码来源:test_forms.py
示例9: test_not_note_owner
def test_not_note_owner(self):
self.note.update(author=user_factory())
data = self._attachments(num=2)
res = self.client.post(self.attachment_url, data=data,
content_type=MULTIPART_CONTENT)
eq_(res.status_code, 403)
开发者ID:demagu-sr,项目名称:zamboni,代码行数:7,代码来源:test_views.py
示例10: test_all_results
def test_all_results(self):
for x in range(4):
name = 'chr' + str(x)
user_factory(email=name)
# Test not at search limit.
data = self.search(q='clouserw')
eq_(len(data['objects']), 1)
# Test search limit.
data = self.search(q='chr')
eq_(len(data['objects']), 2)
# Test maximum search result.
data = self.search(q='chr', limit='max')
eq_(len(data['objects']), 3)
开发者ID:jamesthechamp,项目名称:zamboni,代码行数:16,代码来源:test_views.py
示例11: setUp
def setUp(self):
super(TestNoteListView, self).setUp()
self.extension = extension_factory(name='yip')
self.extension_author = user_factory(email='[email protected]')
self.extension_thread = self.extension.threads.create(
_extension_version=self.extension.latest_version)
self.extension_note = self.extension_thread.notes.create(
author=self.extension_author, body='extension note')
self.app = app_factory(name='yip', app_slug='yip')
self.app_author = user_factory(email='[email protected]')
self.app_thread = self.app.threads.create(
_version=self.app.current_version)
self.app_note = self.app_thread.notes.create(
author=self.app_author, body='webapp note')
self.url = reverse('api-v2:comm-note-list-all')
开发者ID:Fjoerfoks,项目名称:zamboni,代码行数:17,代码来源:test_views.py
示例12: setUp
def setUp(self):
self.extension = extension_factory()
self.version = self.extension.latest_version
self.user = UserProfile.objects.get(email="[email protected]")
self.thread = CommunicationThread.objects.create(_extension=self.extension, _extension_version=self.version)
self.author = user_factory(email="lol")
self.note = CommunicationNote.objects.create(thread=self.thread, author=self.author, note_type=0, body="xyz")
开发者ID:elysium001,项目名称:zamboni,代码行数:8,代码来源:test_models.py
示例13: test_user_total
def test_user_total(self):
day = datetime.date(2009, 1, 1)
p = user_factory(source=mkt.LOGIN_SOURCE_MMO_BROWSERID)
p.update(created=day)
jobs = tasks._get_monolith_jobs
eq_(jobs(day)['mmo_user_count_total'][0]['count'](), 1)
eq_(jobs()['mmo_user_count_total'][0]['count'](), 1)
eq_(jobs()['mmo_user_count_new'][0]['count'](), 0)
开发者ID:atiqueahmedziad,项目名称:zamboni,代码行数:8,代码来源:test_cron.py
示例14: add_pay_account
def add_pay_account(self, provider=PROVIDER_BANGO):
user = user_factory()
acct = PaymentAccount.objects.create(
solitude_seller=SolitudeSeller.objects.create(user=user),
provider=provider, user=user)
AddonPaymentAccount.objects.create(addon=self.webapp,
payment_account=acct)
return acct
开发者ID:mrheides,项目名称:zamboni,代码行数:8,代码来源:test_serializers.py
示例15: test_author
def test_author(self):
app = app_factory()
user = user_factory(display_name='Bob')
thread, note = create_comm_note(app, app.current_version, user, 'hue')
data = serializers.NoteSerializer(note, context={
'request': req_factory_factory()
}).data
eq_(data['author_meta']['name'], 'Bob')
ok_(data['author_meta']['gravatar_hash'])
开发者ID:Fjoerfoks,项目名称:zamboni,代码行数:10,代码来源:test_serializers.py
示例16: test_post_subscribers
def test_post_subscribers(self):
# Same test as above, but add a suscriber. We only want to make sure
# we are not causing a traceback because of that.
reviewer = user_factory(email='[email protected]')
self.grant_permission(reviewer, 'Apps:Review')
EditorSubscription.objects.create(addon=self.app, user=reviewer)
self._post(302)
version = self.app.versions.latest()
eq_(version.version, '1.0')
eq_(version.all_files[0].status, mkt.STATUS_PENDING)
开发者ID:atiqueahmedziad,项目名称:zamboni,代码行数:10,代码来源:test_views_versions.py
示例17: test_reviewer_comment
def test_reviewer_comment(self, email):
another_reviewer = user_factory()
self._create(comm.REVIEWER_COMMENT, author=self.reviewer)
self._create(comm.REVIEWER_COMMENT, author=another_reviewer)
eq_(email.call_count, 1)
recipients = self._recipients(email)
assert self.reviewer.email in recipients
assert self.developer.email not in recipients
self._check_template(email.call_args, 'generic')
开发者ID:mathjazz,项目名称:zamboni,代码行数:11,代码来源:test_utils_mail.py
示例18: test_create_note_existing_thread
def test_create_note_existing_thread(self):
# Initial note.
thread, note = create_comm_note(
self.extension, self.extension.latest_version, self.user, 'huehue')
# Second person joins thread.
thread, last_word = create_comm_note(
self.extension, self.extension.latest_version, user_factory(),
'euheuh!', note_type=comm.MORE_INFO_REQUIRED)
eq_(thread.thread_cc.count(), 2)
开发者ID:Fjoerfoks,项目名称:zamboni,代码行数:11,代码来源:test_utils_.py
示例19: test_get_attachment_not_note_perm
def test_get_attachment_not_note_perm(self):
data = self._attachments(num=1)
res = self.client.post(self.attachment_url, data=data,
content_type=MULTIPART_CONTENT)
attachment_id = res.json['attachments'][0]['id']
# Remove perms.
self.note.update(author=user_factory())
self.profile.addonuser_set.all().delete()
get_attachment_url = reverse('comm-attachment-detail',
args=[self.note.id, attachment_id])
res = self.client.get(get_attachment_url)
eq_(res.status_code, 403)
开发者ID:demagu-sr,项目名称:zamboni,代码行数:13,代码来源:test_views.py
示例20: test_get_leaderboards_last
def test_get_leaderboards_last(self):
users = []
for i in range(6):
users.append(user_factory())
last_user = users.pop(len(users) - 1)
for u in users:
self._give_points(user=u)
# Last user gets lower points by a moderation review.
ReviewerScore.award_moderation_points(last_user, self.app, 1)
leaders = ReviewerScore.get_leaderboards(last_user)
eq_(leaders['user_rank'], 6)
eq_(len(leaders['leader_top']), 3)
eq_(len(leaders['leader_near']), 2)
开发者ID:Jobava,项目名称:zamboni,代码行数:13,代码来源:test_models.py
注:本文中的mkt.site.tests.user_factory函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论