예제 #1
0
 def setUp(self):
     self.user = User.objects.create_user(username='******', email='*****@*****.**', password='******')
     self.client.login(username='******', password='******')
     self.organization = Organization(name='Foo Org')
     self.organization.save()
     assign_admin_perms(self.organization, self.user)
     self.url = reverse('api_retrieve_organization', args=(self.organization.id,))
예제 #2
0
 def setUp(self):
     self.user = User.objects.create_user(username="******", email="*****@*****.**", password="******")
     self.org = Organization(name="Foo Org")
     self.org.save()
     assign_admin_perms(self.org, self.user)
     self.invite = OrganizationInvite(email="*****@*****.**", organization=self.org, user=self.user)
     self.invite.token = get_random_string(length=20, allowed_chars="ABCDEFGHJKMNPQRST23456789")
     self.invite.save()
예제 #3
0
파일: views.py 프로젝트: JBKahn/escalator
    def form_valid(self, form):
        org = Organization(name=form.cleaned_data['name'])
        org.save()
        self.request.user.userprofile.phone_number = form.cleaned_data['phone_number']
        self.request.user.userprofile.save()

        assign_admin_perms(org, self.request.user)
        return super(OrganizationOnboardingView, self).form_valid(form)
예제 #4
0
 def test_create_invite(self):
     self.org = Organization(name="Foo Org")
     self.org.save()
     assign_admin_perms(self.org, self.user)
     url = reverse("api_invite_user", args=(self.org.id,))
     data = {"email": "*****@*****.**"}
     resp = self.client.post(url, data, format="json")
     self.assertEquals(20, len(resp.data["token"]))
     self.assertEquals(resp.data["user"]["id"], self.user.id)
예제 #5
0
 def test_create_invite(self):
     self.org = Organization(name='Foo Org')
     self.org.save()
     assign_admin_perms(self.org, self.user)
     url = reverse('api_invite_user', args=(self.org.id, ))
     data = {"email": "*****@*****.**"}
     resp = self.client.post(url, data, format='json')
     self.assertEquals(20, len(resp.data['token']))
     self.assertEquals(resp.data['user']['id'], self.user.id)
예제 #6
0
 def setUp(self):
     self.user = User.objects.create_user(username='******',
                                          email='*****@*****.**',
                                          password='******')
     self.org = Organization(name='Foo Org')
     self.org.save()
     assign_admin_perms(self.org, self.user)
     self.invite = OrganizationInvite(email='*****@*****.**',
                                      organization=self.org,
                                      user=self.user)
     self.invite.token = get_random_string(
         length=20, allowed_chars='ABCDEFGHJKMNPQRST23456789')
     self.invite.save()
예제 #7
0
파일: views.py 프로젝트: JBKahn/escalator
 def post_save(self, obj, created):
     if created:
         assign_admin_perms(obj, self.request.user)
예제 #8
0
 def post_save(self, obj, created):
     if created:
         assign_admin_perms(obj, self.request.user)