def test_len_of_clients_with_phone_is_gt_one(self, mock_write):
     subscriber = SubscriberSMSFactory.create()
     # non unique
     client = ClientFactory.create(phone=subscriber.phone)
     ClientFactory.create(phone=client.phone)
     call_command('migrate_subscribers')
     assert User.objects.filter(email=client.email,
                                phone=client.phone).exists() is False
Exemple #2
0
    def test_with_client_exists(self):
        user = UserFactory.create()
        ClientFactory.create(email=user.email, phone=user.phone)
        SubscriberFactory.create(email=user.email)
        SubscriberSMSFactory.create(phone=user.phone, gdpr_consent=True)

        call_command('update_gdpr_consent')

        assert User.objects.get(pk=user.pk).gdpr_consent is True
 def test_client_with_same_number_doesnt_exists(self):
     SubscriberSMSFactory.create()
     ClientFactory.create(phone='123123142')
     call_command('migrate_subscribers')
     assert User.objects.filter(email='').exists() is True
 def test_user_with_same_email_exists(self, mock_write):
     subscriber = SubscriberSMSFactory.create()
     client = ClientFactory.create(phone=subscriber.phone)
     UserFactory.create(phone='123123142', email=client.email)
     call_command('migrate_subscribers')
     mock_write.assert_called()
 def test_user_with_same_email_doesnt_exists(self):
     subscriber = SubscriberSMSFactory.create()
     client = ClientFactory.create(phone=subscriber.phone)
     call_command('migrate_subscribers')
     assert User.objects.filter(email=client.email,
                                phone=client.phone).exists() is True
 def test_client_with_same_email_doesnt_exists(self):
     SubscriberFactory.create()
     ClientFactory.create(email='*****@*****.**')
     call_command('migrate_subscribers')
     assert User.objects.filter(phone='').exists() is True
 def test_user_with_same_phone_exists(self, mock_write):
     subscriber = SubscriberFactory.create()
     client = ClientFactory.create(email=subscriber.email)
     UserFactory.create(email='*****@*****.**', phone=client.phone)
     call_command('migrate_subscribers')
     mock_write.assert_called()