Example #1
0
    def test_settings_account(self):
        resp = self.client.get(reverse('user-account'))
        self.assertEqual(resp.status_code, 302)

        self.client.login(username=self.user.username, password='******')
        resp = self.client.get(reverse('user-account'))
        self.assertEqual(resp.status_code, 200)

        lang = LanguageFactory()
        lang.save()
        from resrc.language.models import Language

        resp = self.client.post(reverse('user-account'), {
            'password_old': 'test123',
            'password_new': 'test1234',
            'password_confirm': 'test1234'
        })
        self.assertEqual(resp.status_code, 302)

        resp = self.client.post(reverse('user-account'), {
            'password_old': 'test1234',
            'password_new': 'test1232',
            'password_confirm': 'test1234'
        })
        self.assertEqual(resp.status_code, 200)
Example #2
0
    def test_settings_profile(self):
        resp = self.client.get(reverse('user-settings'))
        self.assertEqual(resp.status_code, 302)

        self.client.login(username=self.user.username, password='******')
        resp = self.client.get(reverse('user-settings'))
        self.assertEqual(resp.status_code, 200)

        lang = LanguageFactory()
        lang.save()
        from resrc.language.models import Language

        resp = self.client.post(reverse('user-settings'), {
            'about': 'My short bio.',
            'email': self.user.email,
            'languages': Language.objects.get(pk=1).pk,
            'show_email': True
        })
        self.assertEqual(resp.status_code, 302)

        resp = self.client.post(reverse('user-settings'), {
            'about': 'My short bio.',
            'email': self.user.email,
            'languages': Language.objects.get(pk=1).pk
        })
        self.assertEqual(resp.status_code, 302)

        resp = self.client.post(reverse('user-settings'), {
            'about': 'My short bio.'
        })
        self.assertEqual(resp.status_code, 200)