本文整理汇总了Python中mkt.site.tests.user_factory函数的典型用法代码示例。如果您正苦于以下问题:Python user_factory函数的具体用法?Python user_factory怎么用?Python user_factory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_factory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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')
示例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)
示例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)
示例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)
示例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')
示例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)
示例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)
示例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'])
示例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)
示例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)
示例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')
示例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")
示例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)
示例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
示例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'])