Пример #1
0
    def test_user_settings(self):
        """Test Function to check User settings"""
        response = self.client.post('/user_detail_change/?action=tabs-1',
                                    {'form-type': 'change-detail',
                                     'first_name': 'admin',
                                     'phone_no': '9324552563'})
        self.assertTrue(response.context['user_detail_form'],
                        UserChangeDetailForm(self.user))
        self.assertTrue(response.context['user_detail_extened_form'],
                        UserChangeDetailExtendForm(self.user))

        response = self.client.post('/user_detail_change/?action=tabs-2',
                                    {'form-type': ''})
        self.assertTrue(response.context['user_password_form'],
                        PasswordChangeForm(self.user))

        response = self.client.get(
            '/user_detail_change/?action=tabs-3&notification=mark_read_all', {})
        self.assertEqual(response.status_code, 200)

        response = self.client.post('/user_detail_change/?action=tabs-5',
                                    {'form-type': 'check-number',
                                     'phone_no': '9324552563'})
        self.assertTrue(response.context['check_phone_no_form'],
                        CheckPhoneNumberForm())
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'user_profile/user_detail_change.html')

        request = self.factory.get('/user_detail_change/')
        request.user = self.user
        request.session = {}
        response = customer_detail_change(request)
        self.assertEqual(response.status_code, 200)
Пример #2
0
    def test_user_settings(self):
        """Test Function to check User settings"""
        response = self.client.get('/user_detail_change/')
        self.assertTrue(response.context['user_detail_form'],
                        UserChangeDetailForm(self.user))
        self.assertTrue(response.context['user_detail_extened_form'],
                        UserChangeDetailExtendForm(self.user))
        self.assertTrue(response.context['user_password_form'],
                        PasswordChangeForm(self.user))
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response,
            'frontend/registration/user_detail_change.html')

        request = self.factory.get('/user_detail_change/')
        request.user = self.user
        request.session = {}
        response = customer_detail_change(request)
        self.assertEqual(response.status_code, 200)

        response = self.client.post('/user_detail_change/?action=tabs-1',
                {'form-type': 'change-detail',
                 'first_name': 'admin',
                 'phone_no': '9324552563'})
        self.assertTrue(response.context['user_detail_form'],
            UserChangeDetailForm(self.user))
        self.assertTrue(response.context['user_detail_extened_form'],
            UserChangeDetailExtendForm(self.user))

        response = self.client.post('/user_detail_change/?action=tabs-2',
                {'form-type': ''})
        self.assertTrue(response.context['user_password_form'],
            PasswordChangeForm(self.user))