示例#1
0
    def test_full_payment_inactive(self):
        user = Database.new_user()
        event = EventDatabase.new_event(start_date=self.date_inactive)
        attendee = EventDatabase.attend(user, event)

        Membership.objects.create(
            user=user, attendee=attendee, bind_date=self.date_inactive, membership_type=MembershipType.FULL
        )

        self.assertEqual(MembershipState.INACTIVE, Membership.objects.get_membership_state(user, datetime.today()))
示例#2
0
    def test_rate_payment_active(self):
        user = Database.new_user()
        event = EventDatabase.new_event(start_date=self.date_active)
        attendee = EventDatabase.attend(user, event)

        Membership.objects.create(
            user=user, attendee=attendee, bind_date=self.date_active, membership_type=MembershipType.RATE
        )

        self.assertEqual(MembershipState.ACTIVE, Membership.objects.get_membership_state(user, datetime.today()))

        self.assertNotEqual(Membership.objects.member_since(user), None)
示例#3
0
    def test_frate_payment_condactive(self):
        user = Database.new_user()
        event = EventDatabase.new_event(start_date=self.date_active)
        attendee = EventDatabase.attend(user, event)

        Membership.objects.create(
            user=user, attendee=attendee, bind_date=self.date_active, membership_type=MembershipType.FRATE
        )

        self.assertEqual(
            MembershipState.CONDITIONAL_ACTIVE, Membership.objects.get_membership_state(user, datetime.today())
        )
示例#4
0
    def test_get_expected_choices_for_active_members(self):
        user = Database.new_user()
        event = EventDatabase.new_event(start_date=self.date_active)
        attendee = EventDatabase.attend(user, event)

        event2 = EventDatabase.new_event(start_date=self.date_active + timedelta(days=1))

        Membership.objects.create(
            user=user, attendee=attendee, bind_date=self.date_active, membership_type=MembershipType.RATE
        )

        assert Membership.objects.get_membership_choices(user, event2) == []
示例#5
0
    def test_registration_gopher_email(self):
        optiongroup = EventDatabase.new_optiongroup(self.event)
        option = EventDatabase.new_option(optiongroup, id=settings.GOPHER_EMAIL_OPTION)

        post_data = Fixtures.valid_registration.copy()
        post_data[OptionGroupForm._get_id(option)] = 'true'

        resp = self.client.post(reverse('avacon_registration'), post_data, follow=True)

        self.assertEqual(resp.status_code, 200)

        messages = Message.objects.all()

        self.assertEqual(len(messages), 2)
示例#6
0
    def test_pass_payment_active_at_the_relevant_event(self):

        user = Database.new_user()
        event = EventDatabase.new_event(start_date=self.date_active)
        attendee = EventDatabase.attend(user, event)

        Membership.objects.create(
            user=user, attendee=attendee, bind_date=self.date_active, membership_type=MembershipType.PASS
        )

        self.assertEqual(
            MembershipState.ACTIVE,
            Membership.objects.get_membership_state(user, self.date_active, fake_upgrade_attendance_as_full=attendee),
        )

        self.assertEqual(Membership.objects.member_since(user), None)
示例#7
0
    def test_get_expected_choices_for_inactive_and_new_member_skip_pass(self):
        user = Database.new_user()
        event = EventDatabase.new_event(start_date=self.date_inactive)

        choices = Membership.objects.get_membership_choices(user, event, allow_pass=False)
        assert len(choices) == 1
        assert MembershipType.RATE in choices
示例#8
0
    def test_get_expected_choices_for_inactive_but_existing_member(self):
        user = Database.new_user()
        event = EventDatabase.new_event(start_date=self.date_inactive)
        attendee = EventDatabase.attend(user, event)

        Membership.objects.create(
            user=user, attendee=attendee, bind_date=self.date_inactive, membership_type=MembershipType.RATE
        )

        event2 = EventDatabase.new_event(start_date=self.date_active)

        assert Membership.objects.get_membership_state(user, self.date_active) == MembershipState.INACTIVE

        choices = Membership.objects.get_membership_choices(user, event2)
        assert len(choices) == 1
        assert MembershipType.RATE in choices
示例#9
0
    def setUp(self):
        achievementGroup = AchievementGroup.objects.create(name='ag', slug='ag')
        self.achievement = Achievement.objects.create(name='a', slug='a',
                                                    group=achievementGroup)

        self.group = Group.objects.create(name='generic group')
        self.user = Database.new_user()
示例#10
0
    def test_get_expected_choices_for_inactive_and_new_member(self):
        user = Database.new_user()
        event = EventDatabase.new_event(start_date=self.date_inactive)

        choices = Membership.objects.get_membership_choices(user, event)
        assert len(choices) == 2
        assert MembershipType.RATE in choices
        assert MembershipType.PASS in choices
示例#11
0
    def test_registration_cosplay_email(self):
        optiongroup1 = EventDatabase.new_optiongroup(self.event)
        option1 = EventDatabase.new_option(optiongroup1, id=settings.COSPLAY_EMAIL_OPTIONS[0])

        optiongroup2 = EventDatabase.new_optiongroup(self.event)
        option2 = EventDatabase.new_option(optiongroup2, id=settings.COSPLAY_EMAIL_OPTIONS[1])

        post_data = Fixtures.valid_registration.copy()
        post_data[OptionGroupForm._get_id(option1)] = 'true'
        post_data[OptionGroupForm._get_id(option2)] = 'true'

        resp = self.client.post(reverse('avacon_registration'), post_data, follow=True)

        self.assertEqual(resp.status_code, 200)

        messages = Message.objects.all()

        self.assertEqual(len(messages), 2)
示例#12
0
    def test_srate_payment_active(self):
        user = Database.new_user()
        event = EventDatabase.new_event(start_date=self.date_active)
        attendee = EventDatabase.attend(user, event)

        Membership.objects.create(
            user=user, attendee=attendee, bind_date=self.date_active, membership_type=MembershipType.FRATE
        )

        event = EventDatabase.new_event(start_date=self.date_active + timedelta(days=1))
        attendee = EventDatabase.attend(user, event)

        Membership.objects.create(
            user=user,
            attendee=attendee,
            bind_date=self.date_active + timedelta(days=1),
            membership_type=MembershipType.SRATE,
        )

        self.assertEqual(MembershipState.ACTIVE, Membership.objects.get_membership_state(user, datetime.today()))
示例#13
0
    def test_valid_sessionid(self):
        user = EventDatabase.new_user(id='test')
        self.client.login_admin(username='******', password='******')

        auth_token = self.client.cookies.get(settings.SESSION_COOKIE_NAME).value

        url = reverse('api_sso_validate',
                      kwargs = {'service' : 'test',
                                'auth_token' : auth_token})

        resp = self.client.get(url)

        self.assertEqual(resp.status_code, 200)
        self.assertEqual(resp.content, u'accepted/test')
示例#14
0
    def test_info(self):
        user = EventDatabase.new_user(id='test')
        self.client.login_admin(username='******', password='******')

        auth_token = self.client.cookies.get(settings.SESSION_COOKIE_NAME).value

        url = reverse('api_sso_info',
                      kwargs = {'service' : 'test',
                                'auth_token' : auth_token})

        resp = self.client.get(url)

        self.assertEqual(resp.status_code, 200)
        self.assertTrue(user.username in resp.content)
        self.assertTrue(user.first_name in resp.content)
        self.assertTrue(user.last_name in resp.content)
        self.assertTrue(user.email in resp.content)
示例#15
0
 def setUp(self):
     self.event = EventDatabase.new_event()