本文整理汇总了Python中eventex.subscriptions.admin.SubscriptionAdmin.mark_as_paid方法的典型用法代码示例。如果您正苦于以下问题:Python SubscriptionAdmin.mark_as_paid方法的具体用法?Python SubscriptionAdmin.mark_as_paid怎么用?Python SubscriptionAdmin.mark_as_paid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eventex.subscriptions.admin.SubscriptionAdmin
的用法示例。
在下文中一共展示了SubscriptionAdmin.mark_as_paid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MarkAsPaidTest
# 需要导入模块: from eventex.subscriptions.admin import SubscriptionAdmin [as 别名]
# 或者: from eventex.subscriptions.admin.SubscriptionAdmin import mark_as_paid [as 别名]
class MarkAsPaidTest(TestCase):
"""
Test Class.
"""
def setUp(self):
"""
Creates an instance of Model Admin.
"""
self.model_admin = SubscriptionAdmin(Subscription, admin.site)
Subscription.objects.create(
name='Davi Garcia',
cpf='12345678901',
email='[email protected]',
phone='(21) 1234-5678'
)
def test_has_action(self):
"""
Action is installed.
"""
self.assertIn('mark_as_paid', self.model_admin.actions)
def test_mark_all(self):
"""
Action to mark all selected as paid.
"""
fake_request = Mock()
queryset = Subscription.objects.all()
self.model_admin.mark_as_paid(fake_request, queryset)
self.assertEqual(1, Subscription.objects.filter(paid=True).count())
示例2: MarkAsPaidTest
# 需要导入模块: from eventex.subscriptions.admin import SubscriptionAdmin [as 别名]
# 或者: from eventex.subscriptions.admin.SubscriptionAdmin import mark_as_paid [as 别名]
class MarkAsPaidTest(TestCase):
def setUp(self):
self.model_admin = SubscriptionAdmin(Subscription, admin.site)
Subscription.objects.create(name='Henrique Bastos', cpf='12345678901',email='[email protected]')
def test_mark_all(self):
fake_request = Mock()
queryset = Subscription.objects.all()
self.model_admin.mark_as_paid(fake_request, queryset)
self.assertEqual(1, Subscription.objects.filter(paid=True).count())
def test_has_action(self):
self.assertIn('mark_as_paid', self.model_admin.actions)
示例3: MarkPaidTest
# 需要导入模块: from eventex.subscriptions.admin import SubscriptionAdmin [as 别名]
# 或者: from eventex.subscriptions.admin.SubscriptionAdmin import mark_as_paid [as 别名]
class MarkPaidTest(TestCase):
def setUp(self):
self.model_admin = SubscriptionAdmin(Subscription, admin.site)
#popula o banco
Subscription.objects.create(name='Dyesten Paulon', cpf='12345678901', email="[email protected]")
def test_has_action(self):
self.assertIn('mark_as_paid', self.model_admin.actions)
def test_mark_all(self):
fake_request = Mock()
queryset = Subscription.objects.all()
self.model_admin.mark_as_paid(fake_request, queryset)
self.assertEqual(1, Subscription.objects.filter(paid=True).count())
示例4: MarkAsPaidTest
# 需要导入模块: from eventex.subscriptions.admin import SubscriptionAdmin [as 别名]
# 或者: from eventex.subscriptions.admin.SubscriptionAdmin import mark_as_paid [as 别名]
class MarkAsPaidTest(TestCase):
def setUp(self):
self.model_admin = SubscriptionAdmin(Subscription, admin.site)
Subscription.objects.create(name=u'Élysson MR', cpf='12345678901', email='[email protected]')
def test_has_action(self):
'Action is not installed.'
self.assertIn('mark_as_paid', self.model_admin.actions)
def test_mark_all(self):
'Everyone must be marked as paid'
fake_request = Mock()
queryset = Subscription.objects.all()
self.model_admin.mark_as_paid(fake_request, queryset)
self.assertEqual(1, Subscription.objects.filter(paid=True).count())
示例5: MarkAsPaid
# 需要导入模块: from eventex.subscriptions.admin import SubscriptionAdmin [as 别名]
# 或者: from eventex.subscriptions.admin.SubscriptionAdmin import mark_as_paid [as 别名]
class MarkAsPaid(TestCase):
def setUp(self):
self.model_admin = SubscriptionAdmin(Subscription, admin.site)
Subscription.objects.create(name='Eduardo', cpf='11122233345', email='[email protected]')
def test_has_action(self):
self.assertIn('mark_as_paid', self.model_admin.actions)
def test_mark_all(self):
fake_request = Mock()
obj = Subscription.objects.create(name='edu', cpf='12345678901', email='[email protected]')
queryset = Subscription.objects.filter(pk=obj.pk)
self.model_admin.mark_as_paid(fake_request, queryset)
self.assertEqual(1, Subscription.objects.filter(paid=True).count())
示例6: MarkAsPaidTest
# 需要导入模块: from eventex.subscriptions.admin import SubscriptionAdmin [as 别名]
# 或者: from eventex.subscriptions.admin.SubscriptionAdmin import mark_as_paid [as 别名]
class MarkAsPaidTest(TestCase):
def setUp(self):
# instancia a model admin
self.model_admin = SubscriptionAdmin(Subscription, admin.site)
# Popula o banco
Subscription.objects.create(name="Rafael Francischini", cpf="12345678901", email="Rafael Francischini")
def test_has_action(self):
"Action is installed"
self.assertIn("mark_as_paid", self.model_admin.actions)
def test_mark_all(self):
"Mark all as paid"
fake_request = Mock()
queryset = Subscription.objects.all()
self.model_admin.mark_as_paid(fake_request, queryset)
self.assertEqual(1, Subscription.objects.filter(paid=True).count())
示例7: MarkAsPaidTest
# 需要导入模块: from eventex.subscriptions.admin import SubscriptionAdmin [as 别名]
# 或者: from eventex.subscriptions.admin.SubscriptionAdmin import mark_as_paid [as 别名]
class MarkAsPaidTest(TestCase):
def setUp(self):
# Instancia o ModelAdmin
self.model_admin = SubscriptionAdmin(Subscription, admin.site)
#Popula o Banco
Subscription.objects.create(name='Hugo Silva', cpf='00000000001',
email='[email protected]')
def test_has_action(self):
'Action is installed'
self.assertIn('mark_as_paid', self.model_admin.actions)
def test_mark_all(self):
fake_request = Mock()
queryset = Subscription.objects.all()
self.model_admin.mark_as_paid(fake_request, queryset)
self.assertEqual(1, Subscription.objects.filter(paid=True).count())
示例8: MarkAsPaidTest
# 需要导入模块: from eventex.subscriptions.admin import SubscriptionAdmin [as 别名]
# 或者: from eventex.subscriptions.admin.SubscriptionAdmin import mark_as_paid [as 别名]
class MarkAsPaidTest(TestCase):
def setUp(self):
# Instancia o Model Admin
self.model_admin = SubscriptionAdmin(Subscription, admin.site)
# Popula o banco
Subscription.objects.create(name='Vitor Hugo Campos', cpf='12345678901',
email='[email protected]')
def test_has_action(self):
'Action is installed'
self.assertIn('mark_as_paid', self.model_admin.actions)
def test_mark_all(self):
'Mark all as paid.'
fake_request = Mock()
queryset = Subscription.objects.all()
self.model_admin.mark_as_paid(fake_request, queryset)
self.assertEqual(1, Subscription.objects.filter(paid=True).count())
示例9: MarkAsPaidTest
# 需要导入模块: from eventex.subscriptions.admin import SubscriptionAdmin [as 别名]
# 或者: from eventex.subscriptions.admin.SubscriptionAdmin import mark_as_paid [as 别名]
class MarkAsPaidTest(TestCase):
def setUp(self):
#Instancia o Model Admin
self.model_admin = SubscriptionAdmin(Subscription, admin.site)
# Popula o banco
Subscription.objects.create(name='Henrique Bastos', cpf='12345678901', email='[email protected]')
def test_has_action(self):
'Action is installed'
self.assertIn('mark_as_paid', self.model_admin.actions)
def test_mark_all(self):
'Mark all as paid.'
fake_request = Mock(spec=HttpRequest, _messages=Mock())
queryset = Subscription.objects.all()
self.model_admin.mark_as_paid(fake_request, queryset)
self.assertEqual(1, Subscription.objects.filter(paid=True).count())
示例10: MarkAsPaidTest
# 需要导入模块: from eventex.subscriptions.admin import SubscriptionAdmin [as 别名]
# 或者: from eventex.subscriptions.admin.SubscriptionAdmin import mark_as_paid [as 别名]
class MarkAsPaidTest(TestCase):
def setUp(self):
# Instância do model admin
self.model_admin = SubscriptionAdmin(Subscription, admin.site)
Subscription.objects.create(name='Matheus', cpf='99999999999',
email='[email protected]')
def test_has_action(self):
""" Action is installed """
self.assertIn('mark_as_paid', self.model_admin.actions)
def test_mark_all_paid(self):
""" Mark all as paid """
fake_request = Mock()
queryset = Subscription.objects.all()
self.model_admin.mark_as_paid(fake_request, queryset)
self.assertEquals(1, Subscription.objects.filter(paid=True).count())
示例11: MarkPaidTest
# 需要导入模块: from eventex.subscriptions.admin import SubscriptionAdmin [as 别名]
# 或者: from eventex.subscriptions.admin.SubscriptionAdmin import mark_as_paid [as 别名]
class MarkPaidTest(TestCase):
def setUp(self):
# instancia o model admin
self.model_admin = SubscriptionAdmin(Subscription, admin.site)
# Popula o banco
Subscription.objects.create(name='AdeilsonT', cpf='123456789022', email='[email protected]')
def test_has_action(self):
'Action is installed'
self.assertIn('mark_as_paid', self.model_admin.actions)
def test_mark_all(self):
'Mark all as paid'
fake_request = Mock()
queryset = Subscription.objects.all()
self.model_admin.mark_as_paid(fake_request, queryset)
self.assertEqual(1, Subscription.objects.filter(paid=True).count())
示例12: MarkAsPaidTest
# 需要导入模块: from eventex.subscriptions.admin import SubscriptionAdmin [as 别名]
# 或者: from eventex.subscriptions.admin.SubscriptionAdmin import mark_as_paid [as 别名]
class MarkAsPaidTest(TestCase):
def setUp(self):
self.model_admin = SubscriptionAdmin(Subscription, admin.site)
Subscription.objects.create(name='Rafael Cassau',
cpf='11111111111',
email='[email protected]')
def test_has_action(self):
'Action is installed.'
self.assertIn('mark_as_paid', self.model_admin.actions)
def test_mark_all(self):
'Mark all as paid'
fake_request = Mock()
queryset = Subscription.objects.all()
self.model_admin.mark_as_paid(fake_request, queryset)
self.assertEqual(1, Subscription.objects.filter(paid=True).count())
示例13: MarkAsPaidTest
# 需要导入模块: from eventex.subscriptions.admin import SubscriptionAdmin [as 别名]
# 或者: from eventex.subscriptions.admin.SubscriptionAdmin import mark_as_paid [as 别名]
class MarkAsPaidTest(TestCase):
def setUp(self):
#Instancia o Model Admin
self.model_admin = SubscriptionAdmin(Subscription, admin.site)
Subscription.objects.create(name='Marcos Dias', cpf='12345678901',
email='[email protected]')
def test_has_action(self):
"""Action instalada"""
self.assertIn('mark_as_paid', self.model_admin.actions)
def test_mark_all(self):
"""Marca todos como pago"""
fake_request = Mock()
queryset = Subscription.objects.all()
self.model_admin.mark_as_paid(fake_request, queryset)
self.assertEqual(1, Subscription.objects.filter(paid=True).count())
示例14: MarkAsPaidTest
# 需要导入模块: from eventex.subscriptions.admin import SubscriptionAdmin [as 别名]
# 或者: from eventex.subscriptions.admin.SubscriptionAdmin import mark_as_paid [as 别名]
class MarkAsPaidTest(TestCase):
def setUp(self):
#Instancia o Model Admin
self.model_admin = SubscriptionAdmin(Subscription, admin.site)
#Popula o BD
Subscription.objects.create(name='Gil', cpf='23423299988', email='[email protected]')
def test_mark_all(self):
'Mark all as paid'
fake_request = Mock()
queryset = Subscription.objects.all()
self.model_admin.mark_as_paid(fake_request, queryset)
self.assertEqual(1, Subscription.objects.filter(paid=True).count())
def test_has_action(self):
'Action is Installed'
self.assertIn('mark_as_paid', self.model_admin.actions)
示例15: MarkAsPaidTest
# 需要导入模块: from eventex.subscriptions.admin import SubscriptionAdmin [as 别名]
# 或者: from eventex.subscriptions.admin.SubscriptionAdmin import mark_as_paid [as 别名]
class MarkAsPaidTest(TestCase):
def setUp(self):
self.model_admin = SubscriptionAdmin(Subscription, admin.site)
Subscription.objects.create(
name='Fulano de Tal',
cpf='12345678901',
email='[email protected]',
)
def test_has_action(self):
"""Action is installed."""
self.assertIn('mark_as_paid', self.model_admin.actions)
def test_mark_all(self):
"""Mark all as paid."""
fake_request = Mock()
queryset = Subscription.objects.all()
self.model_admin.mark_as_paid(fake_request, queryset)
self.assertEqual(1, Subscription.objects.filter(paid=True).count())