Exemplo n.º 1
0
class MarkAsPaidTest(TestCase):
    def setUp(self):
        self.model_admin = SubscriptionAdmin(Subscription, admin.site)

        # Popula o banco
        Subscription.objects.create(
                name='LRezende', 
                cpf='12345678901',
                email='*****@*****.**'
            )

    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())
Exemplo n.º 2
0
    def setUp(self):
        # Instancia o Model Admin
        self.model_admin = SubscriptionAdmin(Subscription, admin.site)

        #  Popula o banco
        Subscription.objects.create(name='Jeferson Calazans',
            cpf='12345678901', email='*****@*****.**')
Exemplo n.º 3
0
    def setUp(self):
        self.model_admin = SubscriptionAdmin(Subscription, admin.site)

        # Popula o banco
        Subscription.objects.create(
                name='LRezende', 
                cpf='12345678901',
                email='*****@*****.**'
            )
Exemplo n.º 4
0
class MarkAsPaidTest(TestCase):
    def setUp(self):
        from subscriptions.admin import SubscriptionAdmin, admin

        self.model_admin = SubscriptionAdmin(Subscription, admin.site)
        Subscription.objects.create(name='Henrique Bastos',
            cpf='12345678901', email='*****@*****.**')

    def test_has_action(self):
        self.assertIn('mark_as_paid', self.model_admin.actions)

    def test_mark_all(self):
        """Mark 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())
Exemplo n.º 5
0
    def setUp(self):
        # Make an Admin model instance
        self.model_admin = SubscriptionAdmin(Subscription, admin.site)

        # Populate data base
        Subscription.objects.create(
            name='Test Testing Name',
            cpf='12345678901',
            email='*****@*****.**',
            phone='12-123456789'
        )
Exemplo n.º 6
0
class MarkAsPaidTest(TestCase):
    def setUp(self):
        # Instancia o Model Admin
        self.model_admin = SubscriptionAdmin(Subscription, admin.site)

        #  Popula o banco
        Subscription.objects.create(name='Jeferson Calazans',
            cpf='12345678901', email='*****@*****.**')

    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())
Exemplo n.º 7
0
class MarkAsPaidTest(TestCase):

    def setUp(self):
        # Instancia o Model Admin
        self.model_admin = SubscriptionAdmin(Subscription, admin.site)

        # Popula o banco
        Subscription.objects.create(name="Rafael Vidal", cpf="82408601225", email="*****@*****.**")


    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())
Exemplo n.º 8
0
class MarkAsPaidTest(TestCase):
    def setUp(self):
        # Make an Admin model instance
        self.model_admin = SubscriptionAdmin(Subscription, admin.site)

        # Populate data base
        Subscription.objects.create(
            name='Test Testing Name',
            cpf='12345678901',
            email='*****@*****.**',
            phone='12-123456789'
        )

    def test_has_action_mark_as_paid(self):
        'Action mark as paid 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())
Exemplo n.º 9
0
    def setUp(self):
        # Instancia o Model Admin
        self.model_admin = SubscriptionAdmin(Subscription, admin.site)

        # Popula o banco
        Subscription.objects.create(name="Rafael Vidal", cpf="82408601225", email="*****@*****.**")
Exemplo n.º 10
0
    def setUp(self):
        from subscriptions.admin import SubscriptionAdmin, admin

        self.model_admin = SubscriptionAdmin(Subscription, admin.site)
        Subscription.objects.create(name='Henrique Bastos',
            cpf='12345678901', email='*****@*****.**')