Exemple #1
0
  def test_logged_in_no_ship(self):
    self.login_as_admin()
    member = Member(user_id=self.user_id)
    member.save()

    res = self.client.get(self.url)

    self.assertEqual(res.status_code, 200)
    self.assertTemplateUsed(res, 'fund/support.html')
    self.assertIsInstance(res.context['member'], Member)
Exemple #2
0
    def test_logged_in_no_ship(self):
        self.login_as_admin()
        member = Member(email="*****@*****.**")
        member.save()

        res = self.client.get(self.url)

        self.assertEqual(res.status_code, 200)
        self.assertTemplateUsed(res, "fund/support.html")
        self.assertIsInstance(res.context["member"], Member)
Exemple #3
0
 def test_unicode(self):
   """ Verify that unicode methods work for Member, GP and Membership """
   project = GivingProject(title=u'Â Fake Giving Project',
                           fundraising_training=timezone.now(),
                           fundraising_deadline=timezone.now())
   project.save()
   member = Member(first_name='Al', last_name=u'Fiüsher')
   member.save()
   membership = Membership(giving_project=project, member=member)
   self.assertEqual(u'Al Fiüsher', unicode(member))
   self.assertEqual(u'Â Fake Giving Project %d' % timezone.now().year, unicode(project))
   self.assertEqual(u'Al Fiüsher, Â Fake Giving Project %d' % timezone.now().year,
                    unicode(membership))
Exemple #4
0
 def login_as_member(self, name):
   if name == "first":
     User.objects.create_user('*****@*****.**', '*****@*****.**', 'one')
     self.client.login(username='******', password='******')
     if 'sjfnw/fund/fixtures/test_fund.json' in self.fixtures:
       self.member_id = 1
       self.ship_id = 1
   elif name == "blank":
     User.objects.create_user('*****@*****.**', '*****@*****.**', 'empty')
     member = Member(email='*****@*****.**', first_name='Blank', last_name='Account')
     member.save()
     self.member_id = member.pk
     self.client.login(username='******', password='******')
   else:
     raise ValueError('Unknown member "{}". Available members: "first", "blank"'.format(name))