Esempio n. 1
0
    def test_id_update(self):
        """
        Test that when an ID update is required and the users update their ID the customer and id status are correctly
         updated
        """
        application = create_and_lodge_application(self.user)
        self.client.login(self.officer.email)
        self.assertTrue(is_client_authenticated(self.client))
        clear_mailbox()
        data = {
            'officer': self.officer.pk,
            'application': application.pk,
            'reason': IDRequest.REASON_CHOICES[0][0],
            'text': 'you to upload an ID.'
        }
        url = reverse('wl_applications:id_request')
        self.assertFalse(is_email())
        response = self.client.post(url, data)
        self.assertEqual(200, response.status_code)
        resp_data = json.loads(response.content.decode('utf8'))
        self.assertIn('id_check_status', resp_data)
        self.assertIn('processing_status', resp_data)
        application.refresh_from_db()
        self.assertEqual('id_required', application.customer_status)
        self.assertEqual('awaiting_update', application.id_check_status)
        self.assertEqual('awaiting_applicant_response',
                         application.processing_status)
        self.assertTrue(is_email())
        email = get_email()
        self.assertIn(application.applicant_profile.email, email.to)
        self.assertEqual(ApplicationIDUpdateRequestedEmail.subject,
                         email.subject)

        # now user upload ID
        self.client.logout()
        self.assertIsNone(self.user.identification)
        self.client.login(self.user.email)
        self.assertTrue(is_client_authenticated(self.client))
        self.client.get(reverse('wl_main:identification'))
        upload_id(self.user)
        self.user.refresh_from_db()
        self.assertIsNotNone(self.user.identification)
        application.refresh_from_db()
        self.assertEqual('updated', application.id_check_status)
        self.assertEqual('under_review', application.customer_status)
        self.assertEqual('ready_for_action', application.processing_status)
Esempio n. 2
0
    def test_id_update(self):
        """
        Test that when an ID update is required and the users update their ID the customer and id status are correctly
         updated
        """
        application = create_and_lodge_application(self.user)
        self.client.login(self.officer.email)
        self.assertTrue(is_client_authenticated(self.client))
        clear_mailbox()
        data = {
            'officer': self.officer.pk,
            'application': application.pk,
            'reason': IDRequest.REASON_CHOICES[0][0],
            'text': 'you to upload an ID.'
        }
        url = reverse('wl_applications:id_request')
        self.assertFalse(is_email())
        response = self.client.post(url, data)
        self.assertEqual(200, response.status_code)
        resp_data = json.loads(response.content.decode('utf8'))
        self.assertIn('id_check_status', resp_data)
        self.assertIn('processing_status', resp_data)
        application.refresh_from_db()
        self.assertEqual('id_required', application.customer_status)
        self.assertEqual('awaiting_update', application.id_check_status)
        self.assertEqual('awaiting_applicant_response', application.processing_status)
        self.assertTrue(is_email())
        email = get_email()
        self.assertIn(application.applicant_profile.email, email.to)
        self.assertEqual(ApplicationIDUpdateRequestedEmail.subject, email.subject)

        # now user upload ID
        self.client.logout()
        self.assertIsNone(self.user.identification)
        self.client.login(self.user.email)
        self.assertTrue(is_client_authenticated(self.client))
        self.client.get(reverse('wl_main:identification'))
        upload_id(self.user)
        self.user.refresh_from_db()
        self.assertIsNotNone(self.user.identification)
        application.refresh_from_db()
        self.assertEqual('updated', application.id_check_status)
        self.assertEqual('under_review', application.customer_status)
        self.assertEqual('ready_for_action', application.processing_status)
Esempio n. 3
0
    def test_upload_id(self):
        """Testing that a user can upload an ID image"""
        self.client.login(self.customer.email)
        self.assertIsNone(self.customer.identification)
        response = self.client.get(reverse('wl_main:identification'))
        self.assertEqual(200, response.status_code)
        response = upload_id(self.customer)
        self.assertEqual(200, response.status_code)

        # update customer
        self.customer.refresh_from_db()

        self.assertIsNotNone(self.customer.identification)
Esempio n. 4
0
    def test_upload_id(self):
        """Testing that a user can upload an ID image"""
        self.client.login(self.customer.email)
        self.assertIsNone(self.customer.identification)
        response = self.client.get(reverse('wl_main:identification'))
        self.assertEqual(200, response.status_code)
        response = upload_id(self.customer)
        self.assertEqual(200, response.status_code)

        # update customer
        self.customer.refresh_from_db()

        self.assertIsNotNone(self.customer.identification)
Esempio n. 5
0
    def test_upload_id(self):
        """Testing that a user can upload an ID image"""
        self.client.login(self.customer.email)
        self.assertIsNone(self.customer.identification)
        response = self.client.get(reverse('wl_main:identification'))
        self.assertEqual(200, response.status_code)
        response = upload_id(self.customer)
        self.assertEqual(200, response.status_code)

        # update customer
        self.customer = EmailUser.objects.get(email=self.customer.email)

        self.assertIsNotNone(self.customer.identification)

        # assert image url is the customer ID's url path
        self.assertEqual(response.context['existing_id_image_url'], self.customer.identification.file.url)
Esempio n. 6
0
    def test_upload_id(self):
        """Testing that a user can upload an ID image"""
        self.client.login(self.customer.email)
        self.assertIsNone(self.customer.identification)
        response = self.client.get(reverse('wl_main:identification'))
        self.assertEqual(200, response.status_code)
        response = upload_id(self.customer)
        self.assertEqual(200, response.status_code)

        # update customer
        self.customer = EmailUser.objects.get(email=self.customer.email)

        self.assertIsNotNone(self.customer.identification)

        # assert image url is the customer ID's url path
        self.assertEqual(response.context['existing_id_image_url'],
                         self.customer.identification.file.url)