コード例 #1
0
ファイル: test_teams.py プロジェクト: dekoza/django-projector
 def test_wrong_username(self):
     wrong_usernames = (' ', '.', '*', 'joe!', '###', ',.<>')
     for username in wrong_usernames:
         data = {'user': username}
         form = DashboardAddMemberForm(self.group, data)
         self.assertFalse(form.is_valid())
         self.assertTrue('user' in form._errors)
コード例 #2
0
 def test_wrong_username(self):
     wrong_usernames = (' ', '.', '*', 'joe!', '###', ',.<>')
     for username in wrong_usernames:
         data = {'user': username}
         form = DashboardAddMemberForm(self.group, data)
         self.assertFalse(form.is_valid())
         self.assertTrue('user' in form._errors)
コード例 #3
0
ファイル: users.py プロジェクト: kryskool/django-projector
 def response(self, request):
     profile = request.user.get_profile()
     if request.user.is_anonymous() or not request.user.is_anonymous or \
         not profile or not profile.is_team:
         messages.warning(request, _('Only teams are allowed to add member'))
         return redirect(reverse('projector_users_profile_detail',
             kwargs={'username': request.user.username}))
     form = DashboardAddMemberForm(profile.group, request.POST or None)
     if request.method == 'POST' and form.is_valid():
         form.save()
         user = form.cleaned_data['user']
         msg = _("User %s is now member of this team!" % user)
         messages.success(request, msg)
         return redirect(reverse('projector_users_profile_detail',
             kwargs={'username': request.user.username}))
     self.context['form'] = form
     self.context['profile'] = profile
     return self.context
コード例 #4
0
ファイル: test_teams.py プロジェクト: dekoza/django-projector
 def test_already_in_group(self):
     data = {'user': self.user.username}
     form = DashboardAddMemberForm(self.group, data)
     self.assertFalse(form.is_valid())
     self.assertTrue('user' in form._errors)
コード例 #5
0
ファイル: test_teams.py プロジェクト: dekoza/django-projector
 def test_proper_user(self):
     joe = User.objects.create(username='******')
     data = {'user': joe.username}
     form = DashboardAddMemberForm(self.group, data)
     self.assertTrue(form.is_valid())
コード例 #6
0
ファイル: test_teams.py プロジェクト: dekoza/django-projector
 def test_wrong_user(self):
     data = {'user': '******'}
     form = DashboardAddMemberForm(self.group, data)
     self.assertFalse(form.is_valid())
     self.assertTrue('user' in form._errors)
コード例 #7
0
 def test_already_in_group(self):
     data = {'user': self.user.username}
     form = DashboardAddMemberForm(self.group, data)
     self.assertFalse(form.is_valid())
     self.assertTrue('user' in form._errors)
コード例 #8
0
 def test_proper_user(self):
     joe = User.objects.create(username='******')
     data = {'user': joe.username}
     form = DashboardAddMemberForm(self.group, data)
     self.assertTrue(form.is_valid())
コード例 #9
0
 def test_wrong_user(self):
     data = {'user': '******'}
     form = DashboardAddMemberForm(self.group, data)
     self.assertFalse(form.is_valid())
     self.assertTrue('user' in form._errors)