Пример #1
0
 def setUp(self):
     self.user = auth_factories.UserFactory(password='******',
                                            is_superuser=True)
     is_logged = self.client.login(username=self.user.username,
                                   password='******')
     AttendeeProfileFactory(user=self.user)
     self.assertTrue(is_logged)
Пример #2
0
    def test_profile(self):
        attendee_profile = AttendeeProfileFactory(user=self.user)
        ticket = TicketFactory(user=self.user)
        ticket_conference = TicketConferenceFactory(ticket=ticket)

        profile = ticket_conference.profile()
        self.assertEqual(attendee_profile, profile)

        ticket = TicketFactory(user=self.user)
        ticket_conference = TicketConferenceFactory(
            ticket=ticket, assigned_to=self.user.email)
        profile = ticket_conference.profile()

        self.assertEqual(attendee_profile, profile)
Пример #3
0
    def test_send_user_message(self, mock_email_message, mock_user_tickets,
                               mock_current, mock_getLink):
        mock_current.return_value = ConferenceFactory.build(
            conference_start=datetime.date.today())
        mock_user_tickets.side_effect = lambda a, b: [(1, 'conference', None,
                                                       True)]

        user_from = auth_factories.UserFactory()
        user_profile = AttendeeProfileFactory(user=user_from)
        self.p3_profile.send_user_message(user_from, 'demo', 'message')

        self.assertTrue(mock_getLink.called)
        self.assertTrue(mock_user_tickets.called)
        self.assertTrue(mock_current.called)
        self.assertTrue(mock_email_message.called)
Пример #4
0
 def setUp(self):
     self.user = auth_factories.UserFactory()
     self.profile = AttendeeProfileFactory(user=self.user)
     self.p3_profile = P3Profile(profile=self.profile)