def test_request_create(self): request = RequestFactory().post( '/accounts/account-request/create/sponsored', data={ 'username':'******', 'password':'******', 'login_shell': '/bin/bash', 'sponsor_email': '*****@*****.**', 'summit':True, 'petalibrary_archive':True, } ) view = SponsoredAccountRequestCreateView.as_view() response = view(request) self.assertTrue(response.url.startswith('/accounts/account-request/review/')) ar = AccountRequest.objects.get(username='******') self.assertEquals(ar.first_name,'test') self.assertEquals(ar.last_name,'user') self.assertEquals(ar.email,'*****@*****.**') self.assertEquals(ar.role, 'sponsored') self.assertEquals(ar.sponsor_email, '*****@*****.**') self.assertEquals(ar.login_shell,'/bin/bash') self.assertEquals(ar.resources_requested,'summit,petalibrary_archive') self.assertEquals(ar.organization,'ucb')
r'^account-request/create$', ReasonView.as_view(), name='account-request-reason' ), url( r'^account-request/create/general$', AccountRequestCreateView.as_view(), name='account-request-create' ), url( r'^account-request/create/class$', ClassAccountRequestCreateView.as_view(), name='class-account-request-create' ), url( r'^account-request/create/sponsored$', SponsoredAccountRequestCreateView.as_view(), name='sponsored-account-request-create' ), url( r'^account-request/create/project$', ProjectAccountRequestCreateView.as_view(), name='project-account-request-create' ), url( r'^account-request/review/(?P<request_id>\d+)', AccountRequestReviewView.as_view(), name='account-request-review' ), ]