Beispiel #1
0
 def test_all(self):
   org = Organization(
     staff_contact_person='Ray',
     staff_contact_person_title='Mx',
     staff_contact_phone='555-999-4242',
     staff_contact_email='[email protected]'
   )
   self.assertEqual(org.get_staff_entered_contact_info(), 'Ray, Mx, 555-999-4242, [email protected]')
Beispiel #2
0
  def test_start_triple_org(self):

    third = Organization(name='third')
    third.save()

    post_data = {
      'action': 'merge',
      '_selected_action': [1, 2, third.pk]
    }
    res = self.client.post(self.admin_url, post_data, follow=True)

    self.assertTemplateUsed(res, 'admin/grants/organization/change_list.html')
    self.assert_message(res, 'Merge can only be done on two organizations. You selected 3.')
Beispiel #3
0
  def clean(self):
    cleaned_data = super(RegisterForm, self).clean()
    org = cleaned_data.get('organization')
    email = cleaned_data.get('email')

    if org and email:
      error_msg = Organization.check_registration(org, email)
      if error_msg:
        raise ValidationError(error_msg)

      password = cleaned_data.get('password')
      passwordtwo = cleaned_data.get('passwordtwo')
      if password and passwordtwo and password != passwordtwo:
        raise ValidationError('Passwords did not match.')

    return cleaned_data
Beispiel #4
0
  def test_admin_entered_match(self):
    """ Org name matches an org that was entered by staff (has no user) """

    org = Organization(name='Ye olde Orge')
    org.save()

    registration = {
      'email': '*****@*****.**',
      'password': '******',
      'passwordtwo': 'one',
      'organization': org.name
    }
    res = self.client.post(self.url, registration, follow=True)

    self.assertEqual(res.status_code, 200)
    self.assertTemplateUsed(res, self.template_error)
    self.assert_message(res, ('You have registered successfully but your '
        'account needs administrator approval. Please contact '
        '<a href="mailto:[email protected]">[email protected]</a>'))

    user = User.objects.get(username=registration['email'])
    self.assertFalse(user.is_active)
    org.refresh_from_db()
    self.assertEqual(org.user, user)
Beispiel #5
0
 class Meta:
   model = Organization
   fields = Organization.get_profile_fields()
Beispiel #6
0
 def test_none(self):
   org = Organization()
   self.assertEqual(org.get_staff_entered_contact_info(), '')
Beispiel #7
0
 def test_some(self):
   org = Organization(staff_contact_person_title='Mx', staff_contact_email='[email protected]')
   self.assertEqual(org.get_staff_entered_contact_info(), 'Mx, [email protected]')