Пример #1
0
  def test_valid(self):
    gp = models.GivingProject.objects.get(title='Pre training')
    member = models.Member(email=TEST_EMAIL, first_name='A', last_name='P')
    member.save()

    membership, error = _create_membership(member, gp)

    self.assertIsNone(error)
    self.assertIsInstance(membership, models.Membership)
    self.assertFalse(membership.approved)
Пример #2
0
  def test_already_exists(self):
    gp = models.GivingProject.objects.get(title='Pre training')
    member = models.Member(email=TEST_EMAIL, first_name='A', last_name='P')
    member.save()
    existing_ship = models.Membership(member=member, giving_project=gp)
    existing_ship.save()

    membership, error = _create_membership(member, gp)

    self.assertRegexpMatches(error, 'already registered')
    self.assertEqual(membership, existing_ship, msg='Returns the pre-existing membership')
Пример #3
0
    def test_valid(self):
        gp = models.GivingProject.objects.get(title='Pre training')
        member = models.Member.objects.create_with_user(email=TEST_EMAIL,
                                                        password='******',
                                                        first_name='A',
                                                        last_name='P')

        membership, error = _create_membership(member, gp)

        self.assertIsNone(error)
        self.assertIsInstance(membership, models.Membership)
        self.assertFalse(membership.approved)
Пример #4
0
    def test_already_exists(self):
        gp = models.GivingProject.objects.get(title='Pre training')
        member = models.Member.objects.create_with_user(email=TEST_EMAIL,
                                                        first_name='A',
                                                        last_name='P')
        member.save()
        existing_ship = models.Membership(member=member, giving_project=gp)
        existing_ship.save()

        membership, error = _create_membership(member, gp)

        self.assertRegexpMatches(error, 'already registered')
        self.assertEqual(membership,
                         existing_ship,
                         msg='Returns the pre-existing membership')