class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Manaia Junior', cpf='1234567890', email='*****@*****.**', phone='84-988929399') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark_as_paid should be installed.""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscriptions as paid.""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should send a message to the user.""" mock = self.call_action() mock.assert_called_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Wellington Marinho', cpf='44387618833', email='*****@*****.**', phone='11951948331') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark_as_paid should be installed.""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all select subscription as paid.""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should send a message to the user.""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptinModelAdminTest(TestCase): def setUp(self): Subscription.objects.create( name="Ricardo Luiz Viana", cpf="12345678901", email="*****@*****.**", phone="31-984260143" ) self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark_as_paid should be installed.""" self.assertIn("mark_as_paid", self.model_admin.actions) def test_mark_all(self): """Ist should mark all selected subscriptions as paid.""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should sen a message to the user""" mock = self.call_action() mock.assert_called_once_with(None, "1 inscrição foi marcada como paga.") def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Lucas farias', cpf='12345678901', email='*****@*****.**', phone='71-991625771') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): # """ Action mark_as_paid should be installed""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should a message to the user""" mock = self.call_action() mock.assert_called_with(None, '1 inscrição foi marcada como paga.') SubscriptionModelAdmin.message_user = mock.old_message_user def call_action(self): query_set = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, query_set) SubscriptionModelAdmin.message_user = old_message_user return mock
def setUp(self): self.startTime = time() Subscription.objects.create(name='Ramiro Alvaro', cpf='12345678901', email='*****@*****.**', phone='31-991387178') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Gustavo Brito', cpf='12345678901', email='*****@*****.**', phone='21-993587250') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) queryset = Subscription.objects.all() def test_has_action(self): model_admin = SubscriptionModelAdmin(Subscription, admin.site) self.assertIn('mark_as_paid', model_admin.actions) def test_mark_all(self): self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Jasiel Serra', cpf='12345678901', email='*****@*****.**', phone='75-99157-8787') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): ''' Action mark_as_paid should be installed.''' self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): '''It should mark all selected subscriptions as paid.''' self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): '''It should send a message to the user.''' mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock # chamar a action self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
def setUp(self): Subscription.objects.create(name='Henrique Bastos', cpf='12345678901', email='*****@*****.**', phone='21-996186180') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Eric Vieira', cpf='12345678901', email='*****@*****.**', phone='21-99889-3320') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark_as_paid should be installed.""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscription as paid""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should send a message for user.""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
def setUp(self): Subscription.objects.create(name='Jasiel Serra', cpf='12345678901', email='*****@*****.**', phone='75-99157-8787') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Victor Hugo', cpf='12345678901', email='*****@*****.**', phone='81-998832982') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark_as_paid sould be installed.""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscriptions as paid.""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) # Resultado def test_message(self): """It should send a message to the user.""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
def setUp(self): Subscription.objects.create(name='Carlos Arruda', cpf='12345678911', email='*****@*****.**', phone='31996840810') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create(name='Joao Luiz', cpf='098765432109', email='*****@*****.**', phone='123456789') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create(name="Anderson", cpf='1', email='a@a', phone='1') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create(name='Nome Teste', cpf='12345678901', email='*****@*****.**', phone='1212') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create(name='Gabriel Dantas', cpf='12345678901', email='*****@*****.**', phone='81-98965-2002') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create(name='Orlando Saboia', cpf='12345678901', email='*****@*****.**', phone='86-12345-6789') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(nome='Thiago Corôa',email='*****@*****.**', telefone='99999-9999',cpf='12345678900') self.model_admin= SubscriptionModelAdmin(Subscription,admin.site) def test_has_action(self): '''ação marcar_pagos deve estar instalada''' self.assertIn('mark_as_paid',self.model_admin.actions) def test_mark_all(self): '''devem marcar todas as inscrições ''' self.call_action() self.assertEqual(1,Subscription.objects.filter(paid=True).count()) def test_message(self): mock=self.call_action() mock.assert_called_once_with(None,'1 Inscrição foi marcada como paga.') def call_action(self): queryset= Subscription.objects.all() mock=Mock() old_message_user= SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user=mock self.model_admin.mark_as_paid(None,queryset) SubscriptionModelAdmin.message_user=old_message_user return mock
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create( name="Cleber Fonseca", cpf="2345678901", email="*****@*****.**", phone="53-99487480" ) self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark_as_paid should be installed""" self.assertIn("mark_as_paid", self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscriptions as paid""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should send a message to the user""" mock = self.call_action() mock.assert_called_once_with(None, "1 inscrição foi marcada como paga.") def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptionModeAdmintest(TestCase): def setUp(self): Subscription.objects.create(name='Rodrigo Magalhães', cpf='99789316003', email='*****@*****.**', phone='(88) 3520-8987') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark_as_paid should be installde.""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscriptions as paid""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should send a message to the user.""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Mario Santos', cpf='12345678901', email='*****@*****.**', phone='21-99991190') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_mask_as_paid_action(self): self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all_as_paid(self): self.call_mark_as_paid_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_send_a_message_to_user(self): mock = self.call_mark_as_paid_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') @mock.patch('django.contrib.admin.ModelAdmin.message_user') def call_mark_as_paid_action(self, mock_message_user): queryset = Subscription.objects.all() self.model_admin.mark_as_paid(None, queryset) return mock_message_user
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Tiago Sá', cpf='12345678901', email='*****@*****.**', phone='91-98424-5276') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): self.assertIn('mark_as_paid', self.model_admin.actions) def test_mask_all(self): """ Mark all as paid""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_messenger(self): mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
def setUp(self): Subscription.objects.create(name='Levi Leal', cpf='12345678901', email='*****@*****.**', phone='38-991935195') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self) -> None: Subscription.objects.create(name='Rodrigo Delfino', cpf='1234657900', email='*****@*****.**', phone='00-00000000') self.model_admin = SubscriptionModelAdmin(model=Subscription, admin_site=admin.site)
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name="Gabriel Pedroso", email="*****@*****.**", cpf="12345678901", phone="12-996582594") self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark_as_paid should be installed""" model_admin = SubscriptionModelAdmin(Subscription, admin.site) self.assertIn('mark_as_paid', model_admin.actions) def test_mark_all_as_paid(self): """It should mark all selected subscriptions as paid.""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid = True).count()) def test_message(self): """It should send a message to the user.""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
def setUp(self): Subscription.objects.create( name='José Renato', cpf='01234567890', email='*****@*****.**', phone='86-995925144') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create(nome='Jocsã Kesley', cpf='08838184429', email='*****@*****.**', telefone='84-996203426') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Adriano Oliveira', cpf='85215856320', email='*****@*****.**', phone='85-999473839') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """action mark as paid shuold be installed.""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscriptions as paid""" self.call_action() # chamar a action self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should send a message to the user""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Rafael Barrelo', cpf='12312312312', email='*****@*****.**', phone='11-123123123') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Actiom mark_as_paid should be installed""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscriptions as paid""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should send a message to the user""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptionAdmin(TestCase): def setUp(self): Subscription.objects.create(name="Felipe Panegalli", cpf="12312312345", email="*****@*****.**", phone="12-12345-1234") self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
def setUp(self): Subscription.objects.create(name='Paulo Roberto', cpf='12345678901', email='*****@*****.**', phone='12-99221-8616') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create(name='Matheus Fernandes', cpf='12345678901', email='*****@*****.**', phone='14-996055972') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
class SubscriptionModelAdminTest(TestCase): def setUp(self) -> None: Subscription.objects.create(name='Jose das Couves', cpf='01234567890', email='*****@*****.**', phone='21 999998888') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock def test_has_action(self): """Action mark_as_paid should be installed""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscription as paid""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should send a message to the user""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.')
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Carlos Eduardo Nogueira', cpf='12345678901', email='*****@*****.**', phone='11-12345678') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark_as_paid should be installed""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscriptions as paid.""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should send a message to the user.""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create( name='Bruno Barbosa', cpf='12345678901', phone='61-8121-0000', email='*****@*****.**' ) self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark as paid should be installed""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscriptions as paid""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptionModelAdminTest(TestCase): def setUp(self): self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) Subscription.objects.create(name='Lucas Rangel Cezimbra', cpf='12345678901', email='*****@*****.**', phone='(51) 8210.0596') def test_has_action(self): """Action mask_as_paid should be installed""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscriptions as paid""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should send a success message to the user""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Matheus Fernandes', cpf='12345678901', email='*****@*****.**', phone='14-996055972') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): '''Action mark as paid should be installed''' self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): '''It should mark all select subscriptions as paid''' self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): '''It should send a mensage to the user''' mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
def setUp(self): Subscription.objects.create(name='Fulano de Tal', cpf='12345678901', email='*****@*****.**', phone='98-983868543') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Henrique Bastos', cpf='12345678901', email='*****@*****.**', phone='21-996186180') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark_as_paid should be installed.""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscriptions as paid.""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should send a message to the user.""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi maracda como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
def setUp(self): Subscription.objects.create(name='Mario Santos', cpf='12345678901', email='*****@*****.**', phone='21-99991190') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create( name='Guilherme Hübner', cpf='12345678901', email='*****@*****.**', phone='31-987888531' ) self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark_as_paid should be installed""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscriptions as paid""" self.call_action() self.assertEqual(Subscription.objects.filter(paid=True).count(), 1) def test_message(self): """It should send a message to the user""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, Subscription.objects.all()) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Nicolai Hygino', cpf='01234567890', email='*****@*****.**', phone='21 98258-5168', paid='True') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action desmark_paid should be instaled""" self.assertIn('desmark_paid', self.model_admin.actions) def test_desmark_all(self): """It shout desmark all selectec option as paid""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=False).count()) def test_message(self): mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi desmarcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_messege_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.desmark_paid(None, queryset) SubscriptionModelAdmin.message_user = old_messege_user return mock
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Rafael Vettori', cpf='12345678901', email='*****@*****.**', phone='321321321') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark_as_paid should be installed""" self.call_action() self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscriptions as paid.""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It shoud send amessage to the user""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptionActionAdmin(TestCase): def setUp(self): Subscription.objects.create(name='John Doe', cpf='12345678900', email='*****@*****.**', phone='2345678') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark_as_paid should be installed""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It must mark all selected subscriptions as paid""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should send a message to the user""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() original_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = original_message_user return mock
def setUp(self): Subscription.objects.create( name='Regis da Silva', cpf='71124336656', email='*****@*****.**', phone='11-91234-5678') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create(name='Henrique Bastos', cpf='12345678901', email='*****@*****.**', phone='21-999887766') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create( name='Xelo Ximira', cpf='12345678910', email='*****@*****.**', phone='1122334455' ) self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create( name='Bruno Barbosa', cpf='12345678901', phone='61-8121-0000', email='*****@*****.**' ) self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create( name='Guilherme Hübner', cpf='12345678901', email='*****@*****.**', phone='31-987888531' ) self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
class SubscriptionModelAdminTest(TestCase): def setUp(self): # criando inscriçao no BD Subscription.objects.create(name='Diego Ubirajara', cpf='12345678901', email='*****@*****.**', phone='626556608') # instacia SubscriptionModelAdmin self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark as paid should be installed""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscriptions as paid""" self.call_action() # Verifica resultado self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should send a message to the user""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscriçao foi marcada como paga.') def call_action(self): # montando una query queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock # Chama action pasando queryset self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create( name='Regis da Silva', cpf='71124336656', email='*****@*****.**', phone='11-91234-5678') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): ''' Action mark_as_paid should be installed. ''' self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): ''' It should mark all selected subscriptions as paid. ''' self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): ''' It should send a message to the user. ''' mock = self.call_action() mock.assert_called_once_with( None, '1 inscrição foi marcada como paga.') def call_action(self): queryset = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, queryset) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptionModelAdminTest(TestCase): def setUp(self): #cria uma inscrição no banco Subscription.objects.create(name="Andre Marcos Gelhen", cpf="12345678901", email="*****@*****.**", phone="49-88088808") #instancio o subscription model admin self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark_as_paid should be installed""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It should mark all selected subscriptions as paid""" self.call_action() #verifico o resultado self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should send a message to the user.""" mock = self.call_action() mock.assert_called_once_with(None, '1 inscrição foi marcada como paga.') def call_action(self): #montando uma query queryset = Subscription.objects.all() mock = Mock() #guardo o stado anterior old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock #chama a action passando o queryset self.model_admin.mark_as_paid(None, queryset) return mock
class SubscriptionsModelAdminTest(TestCase): def setUp(self): Subscription.objects.create(name='Edimar Fardim', cpf='07194667762', email='*****@*****.**', phone='27988222771') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Actions mark_as_paid should be installed""" self.assertIn('mark_as_paid', self.model_admin.actions) def test_mask_all(self): """It should mark all selected subscriptions as paid""" self.call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): """It should send a mensage to the user""" mock = self.call_action() mock.assert_called_once_with(None, '1 Inscricao foi marcada como paga') def call_action(self): query_set = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, query_set) SubscriptionModelAdmin.message_user = old_message_user return mock
class SubscriptionModelAdminTest(TestCase): def setUp(self): Subscription.objects.create( name='Arilson Santos', cpf='12345678901', email='*****@*****.**', phone='11-951936261') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site) def test_has_action(self): """Action mark_as_paid should be installed. """ self.assertIn('mark_as_paid', self.model_admin.actions) def test_mark_all(self): """It shoud mark all selected subscriptions as paid.""" self._call_action() self.assertEqual(1, Subscription.objects.filter(paid=True).count()) def test_message(self): mock = self._call_action() mock.assert_called_once_with( None, '1 inscrição foi marcada como paga.') def _call_action(self): querysert = Subscription.objects.all() mock = Mock() old_message_user = SubscriptionModelAdmin.message_user SubscriptionModelAdmin.message_user = mock self.model_admin.mark_as_paid(None, querysert) SubscriptionModelAdmin.message_user = old_message_user return mock
def setUp(self): Subscription.objects.create(name='Rafael Barrelo', cpf='12312312312', email='*****@*****.**', phone='11-123123123') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create( name="Vitor Hidalgo", cpf="12345678901", email="*****@*****.**", phone="11-971689949" ) self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create( name="Cleber Fonseca", cpf="2345678901", email="*****@*****.**", phone="53-99487480" ) self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create(name='Ricardo Anzolin', cpf='12345678901', email='*****@*****.**', phone='4612345789') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create(name='Satangoz Silva', cpf='12345678901', email='*****@*****.**', phone='81-966666666') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)
def setUp(self): Subscription.objects.create(name='Hiarison Gigante', cpf='12345678901', email='*****@*****.**', phone='+55 21 9900 9900') self.model_admin = SubscriptionModelAdmin(Subscription, admin.site)