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
Пример #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
Пример #3
0
 def test_user_that_is_not_meeting_client(self):
     self.request.user = ClientFactory()
     self.assertFalse(
         self.permission_client.has_object_permission(
             self.request,
             self.view,
             self.meeting,
         ))
Пример #4
0
 def test_tag_creation_as_client(self):
     client_user = ClientFactory()
     self.client.login(
         username=client_user.user.username,
         password=client_user.user.password,)
     url = reverse('calendar:tag-list')
     data = { 'name': 'tag_name'}
     response = self.client.post(url, data, format='json')
     self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
Пример #5
0
 def test_user_that_is_meeting_client(self):
     user = ClientFactory()
     self.meeting.clients.add(user)
     self.request.user = user
     self.assertTrue(
         self.permission_client.has_object_permission(
             self.request,
             self.view,
             self.meeting,
         ))
 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
Пример #10
0
 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()