Ejemplo n.º 1
0
 def test_permissions_delete_user_for_anonymous(self):
     client, _ = _init_client()
     profile = UserProfileGenerator().generate(
         role=UserProfileGenerator.MANAGER).pop(0)
     response = client.get(
         reverse('orders_manager:delete_user',
                 kwargs={'username': profile.get_username()}))
     self.assertRedirects(
         response,
         reverse('orders_manager:login') + '?next={}'.format(
             reverse('orders_manager:delete_user',
                     kwargs={'username': profile.get_username()})))
     self.assertEqual(response.status_code, 302)
Ejemplo n.º 2
0
 def test_permissions_delete_user_for_anonymous(self):
     client, _ = _init_client()
     profile = UserProfileGenerator().generate(
         role=UserProfileGenerator.MANAGER).pop(0)
     response = client.get(
         reverse('orders_manager:delete_user',
                 kwargs={'username': profile.get_username()}))
     self.assertRedirects(
         response,
         reverse('orders_manager:login') + '?next={}'.format(reverse(
             'orders_manager:delete_user',
             kwargs={'username': profile.get_username()}))
     )
     self.assertEqual(response.status_code, 302)
Ejemplo n.º 3
0
class CreateUserProfileFormTestCase(TestCase):
    def setUp(self):
        self.my_profile = UserProfileGenerator().generate(
            role=UserProfileGenerator.MANAGER).pop(0)

    def test_create_user_profile_common_case(self):
        m_data = dict(
            username=self.my_profile.get_username(),
            first_name=self.my_profile.get_first_name(),
            last_name=self.my_profile.get_last_name(),
            email=self.my_profile.get_email(),
            phone=self.my_profile.get_phone(),
            address=self.my_profile.get_address(),
            weekends=['wed', 'mon'],
            password='******',
            confirm_password='******'
        )

        form = CreateUserProfileForm(data=m_data, **{'user_role': 'manager'})
        self.assertTrue(form.is_valid())