Ejemplo n.º 1
0
    def test_request_create(self):
        request = RequestFactory().post(
                '/accounts/account-request/create/project',
                data={
                    'projects': [proj.pk for proj in Project.objects.all()],
                    'organization':'ucb',
                    'username':'******',
                    'password':'******',
                    'login_shell': '/bin/bash',
                    'role': 'student',
                }
            )
        view = ProjectAccountRequestCreateView.as_view()
        response = view(request)

        self.assertTrue(response.url.startswith('/accounts/account-request/review/'))

        ar = AccountRequest.objects.get(username='******')
        ar_list = [p.pk for p in ar.projects.all()]
        expected_list = [p.pk for p in Project.objects.all()]
        self.assertEquals(ar_list,expected_list)
        self.assertEquals(ar.first_name,'test')
        self.assertEquals(ar.last_name,'user')
        self.assertEquals(ar.email,'*****@*****.**')
        self.assertEquals(ar.role, 'student')
        self.assertEquals(ar.login_shell,'/bin/bash')
        self.assertEquals(ar.organization,'ucb')
Ejemplo n.º 2
0
        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'
    ),
]