def _test(self, type, exists): Installed.objects.create(user=self.user, addon=self.app, install_type=type) if exists: eq_(list(purchase_list(self.req, self.user, None)[0].object_list), [self.app]) else: assert not purchase_list(self.req, self.user, None)[0].object_list
def user_activity(request, user_id): """Shows the user activity page for another user.""" user = get_object_or_404(UserProfile, pk=user_id) products, contributions, listing = purchase_list(request, user, None) is_admin = acl.action_allowed(request, 'Users', 'Edit') collections = Collection.objects.filter(author=user_id) user_items = ActivityLog.objects.for_user(user).exclude( action__in=amo.LOG_HIDE_DEVELOPER) admin_items = ActivityLog.objects.for_user(user).filter( action__in=amo.LOG_HIDE_DEVELOPER) amo.log(amo.LOG.ADMIN_VIEWED_LOG, request.amo_user, user=user) return jingo.render( request, 'lookup/user_activity.html', { 'pager': products, 'account': user, 'is_admin': is_admin, 'listing_filter': listing, 'collections': collections, 'contributions': contributions, 'single': bool(None), 'user_items': user_items, 'admin_items': admin_items, 'show_link': False })
def user_activity(request, user_id): """Shows the user activity page for another user.""" user = get_object_or_404(UserProfile, pk=user_id) products, contributions, listing = purchase_list(request, user, None) is_admin = acl.action_allowed(request, "Users", "Edit") collections = Collection.objects.filter(author=user_id) user_items = ActivityLog.objects.for_user(user).exclude(action__in=amo.LOG_HIDE_DEVELOPER) admin_items = ActivityLog.objects.for_user(user).filter(action__in=amo.LOG_HIDE_DEVELOPER) amo.log(amo.LOG.ADMIN_VIEWED_LOG, request.amo_user, user=user) return jingo.render( request, "lookup/user_activity.html", { "pager": products, "account": user, "is_admin": is_admin, "listing_filter": listing, "collections": collections, "contributions": contributions, "single": bool(None), "user_items": user_items, "admin_items": admin_items, "show_link": False, }, )
def test_ordering(self): self.user.installed_set.create(addon=self.app, install_type=apps.INSTALL_TYPE_USER) app2 = app_factory() self.user.installed_set.create(addon=app2, install_type=apps.INSTALL_TYPE_USER) eq_(list(purchase_list(self.req, self.user).object_list), [app2, self.app])
def test_contribution_installed_same_app(self): self.user.installed_set.create( webapp=self.app, install_type=apps.INSTALL_TYPE_USER) self.user.contribution_set.create( webapp=self.app, type=mkt.CONTRIB_PURCHASE) eq_(list(purchase_list(self.req, self.user).object_list), [self.app])
def user_purchases(request, user_id): """Shows the purchase page for another user.""" user = get_object_or_404(UserProfile, pk=user_id) is_admin = acl.action_allowed(request, 'Users', 'Edit') products = purchase_list(request, user) return render(request, 'lookup/user_purchases.html', {'pager': products, 'account': user, 'is_admin': is_admin, 'single': bool(None), 'show_link': False})
def test_ordering(self): self.user.installed_set.create( webapp=self.app, install_type=apps.INSTALL_TYPE_USER) app2 = app_factory() self.user.installed_set.create( webapp=app2, install_type=apps.INSTALL_TYPE_USER) eq_(list(purchase_list(self.req, self.user).object_list), [app2, self.app])
def purchases(request, user_id): """Shows the purchase page for another user.""" user = get_object_or_404(UserProfile, pk=user_id) products, contributions, listing = purchase_list(request, user, None) return jingo.render(request, 'acct_lookup/purchases.html', {'pager': products, 'account': user, 'listing_filter': listing, 'contributions': contributions, 'single': bool(None), 'show_link': False})
def activity(request, user_id): """Shows the user activity page for another user.""" user = get_object_or_404(UserProfile, pk=user_id) products, contributions, listing = purchase_list(request, user, None) collections = Collection.objects.filter(author=user_id) return jingo.render(request, 'acct_lookup/activity.html', {'pager': products, 'account': user, 'listing_filter': listing, 'collections': collections, 'contributions': contributions, 'single': bool(None), 'show_link': False})
def purchases(request, user_id): """Shows the purchase page for another user.""" user = get_object_or_404(UserProfile, pk=user_id) products, contributions, listing = purchase_list(request, user, None) return jingo.render( request, "acct_lookup/purchases.html", { "pager": products, "listing_filter": listing, "contributions": contributions, "single": bool(None), "show_link": False, }, )
def user_activity(request, user_id): """Shows the user activity page for another user.""" user = get_object_or_404(UserProfile, pk=user_id) products = purchase_list(request, user) is_admin = acl.action_allowed(request, 'Users', 'Edit') user_items = ActivityLog.objects.for_user(user).exclude( action__in=mkt.LOG_HIDE_DEVELOPER) admin_items = ActivityLog.objects.for_user(user).filter( action__in=mkt.LOG_HIDE_DEVELOPER) mkt.log(mkt.LOG.ADMIN_VIEWED_LOG, request.user, user=user) return render(request, 'lookup/user_activity.html', {'pager': products, 'account': user, 'is_admin': is_admin, 'single': bool(None), 'user_items': user_items, 'admin_items': admin_items, 'show_link': False})
def activity(request, user_id): """Shows the user activity page for another user.""" user = get_object_or_404(UserProfile, pk=user_id) products, contributions, listing = purchase_list(request, user, None) collections = Collection.objects.filter(author=user_id) return jingo.render( request, 'acct_lookup/activity.html', { 'pager': products, 'account': user, 'listing_filter': listing, 'collections': collections, 'contributions': contributions, 'single': bool(None), 'show_link': False })
def user_purchases(request, user_id): """Shows the purchase page for another user.""" user = get_object_or_404(UserProfile, pk=user_id) is_admin = acl.action_allowed(request, "Users", "Edit") products, contributions, listing = purchase_list(request, user, None) return jingo.render( request, "lookup/user_purchases.html", { "pager": products, "account": user, "is_admin": is_admin, "listing_filter": listing, "contributions": contributions, "single": bool(None), "show_link": False, }, )
def user_activity(request, user_id): """Shows the user activity page for another user.""" user = get_object_or_404(UserProfile, pk=user_id) products, contributions, listing = purchase_list(request, user, None) is_admin = acl.action_allowed(request, 'Users', 'Edit') collections = Collection.objects.filter(author=user_id) user_items = ActivityLog.objects.for_user(user).exclude( action__in=amo.LOG_HIDE_DEVELOPER) admin_items = ActivityLog.objects.for_user(user).filter( action__in=amo.LOG_HIDE_DEVELOPER) amo.log(amo.LOG.ADMIN_VIEWED_LOG, request.amo_user, user=user) return jingo.render(request, 'lookup/user_activity.html', {'pager': products, 'account': user, 'is_admin': is_admin, 'listing_filter': listing, 'collections': collections, 'contributions': contributions, 'single': bool(None), 'user_items': user_items, 'admin_items': admin_items, 'show_link': False})
def test_contribution_purchase(self): self.user.contribution_set.create( webapp=self.app, type=mkt.CONTRIB_PURCHASE) eq_(list(purchase_list(self.req, self.user).object_list), [self.app])
def test_contribution_installed_same_app(self): self.user.installed_set.create(addon=self.app, install_type=apps.INSTALL_TYPE_USER) self.user.contribution_set.create(addon=self.app, type=mkt.CONTRIB_PURCHASE) eq_(list(purchase_list(self.req, self.user).object_list), [self.app])
def test_contribution_chargeback(self): self.user.contribution_set.create(addon=self.app, type=mkt.CONTRIB_CHARGEBACK) eq_(list(purchase_list(self.req, self.user).object_list), [self.app])
def test_reviewer(self): self.user.installed_set.create( webapp=self.app, install_type=apps.INSTALL_TYPE_REVIEWER) eq_(list(purchase_list(self.req, self.user).object_list), [])
def test_reviewer(self): self.user.installed_set.create(addon=self.app, install_type=apps.INSTALL_TYPE_REVIEWER) eq_(list(purchase_list(self.req, self.user).object_list), [])
def test_developer(self): self.user.installed_set.create( addon=self.app, install_type=apps.INSTALL_TYPE_DEVELOPER) eq_(list(purchase_list(self.req, self.user).object_list), [self.app])
def test_contribution_refund(self): self.user.contribution_set.create( webapp=self.app, type=mkt.CONTRIB_REFUND) eq_(list(purchase_list(self.req, self.user).object_list), [self.app])
def test_contribution_chargeback(self): self.user.contribution_set.create( webapp=self.app, type=mkt.CONTRIB_CHARGEBACK) eq_(list(purchase_list(self.req, self.user).object_list), [self.app])
def test_user(self): self.user.installed_set.create( addon=self.app, install_type=apps.INSTALL_TYPE_USER) eq_(list(purchase_list(self.req, self.user).object_list), [self.app])
def test_contribution_purchase(self): self.user.contribution_set.create(addon=self.app, type=mkt.CONTRIB_PURCHASE) eq_(list(purchase_list(self.req, self.user).object_list), [self.app])
def test_contribution_refund(self): self.user.contribution_set.create(addon=self.app, type=mkt.CONTRIB_REFUND) eq_(list(purchase_list(self.req, self.user).object_list), [self.app])
def test_developer(self): self.user.installed_set.create( webapp=self.app, install_type=apps.INSTALL_TYPE_DEVELOPER) eq_(list(purchase_list(self.req, self.user).object_list), [self.app])