當前位置: 首頁>>代碼示例>>Python>>正文


Python AttendanceFactory.create方法代碼示例

本文整理匯總了Python中remo.events.tests.AttendanceFactory.create方法的典型用法代碼示例。如果您正苦於以下問題:Python AttendanceFactory.create方法的具體用法?Python AttendanceFactory.create怎麽用?Python AttendanceFactory.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在remo.events.tests.AttendanceFactory的用法示例。


在下文中一共展示了AttendanceFactory.create方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_unsubscribe_from_event_subscribed

# 需要導入模塊: from remo.events.tests import AttendanceFactory [as 別名]
# 或者: from remo.events.tests.AttendanceFactory import create [as 別名]
 def test_unsubscribe_from_event_subscribed(self, mock_success):
     """Test unsubscribe from event subscribed user."""
     user = UserFactory.create(groups=['Rep'])
     event = EventFactory.create()
     AttendanceFactory.create(user=user, event=event)
     self.client.login(username=user.username, password='passwd')
     response = self.client.post(reverse('events_unsubscribe_from_event',
                                         kwargs={'slug': event.slug}),
                                 follow=True)
     self.assertTemplateUsed(response, 'view_event.html',
                             ('Rep user is not returned to '
                              'event page after unsubscribing.'))
     msg = 'You have unsubscribed from this event.'
     mock_success.assert_called_with(ANY, msg)
開發者ID:Mte90,項目名稱:remo,代碼行數:16,代碼來源:test_views.py

示例2: test_subscription_management_subscribed

# 需要導入模塊: from remo.events.tests import AttendanceFactory [as 別名]
# 或者: from remo.events.tests.AttendanceFactory import create [as 別名]
 def test_subscription_management_subscribed(self, mock_warning):
     """ Test subscribe already subscribed user."""
     user = UserFactory.create(groups=['Rep'])
     event = EventFactory.create()
     AttendanceFactory.create(user=user, event=event)
     self.client.login(username=user.username, password='passwd')
     response = self.client.post(reverse('events_subscribe_to_event',
                                         kwargs={'slug': event.slug}),
                                 follow=True)
     self.assertTemplateUsed(response, 'view_event.html',
                             ('Rep user is not returned to '
                              'event page after subscribing.'))
     msg = 'You are already subscribed to this event.'
     mock_warning.assert_called_with(ANY, msg)
開發者ID:Mte90,項目名稱:remo,代碼行數:16,代碼來源:test_views.py

示例3: test_delete_passive_event_attendance_report

# 需要導入模塊: from remo.events.tests import AttendanceFactory [as 別名]
# 或者: from remo.events.tests.AttendanceFactory import create [as 別名]
 def test_delete_passive_event_attendance_report(self):
     """Test delete passive report after attendance delete."""
     event = EventFactory.create()
     user = UserFactory.create(groups=['Rep', 'Mentor'],
                               userprofile__initial_council=True)
     attendance = AttendanceFactory.create(event=event, user=user)
     ok_(NGReport.objects.filter(event=event, user=user).exists())
     attendance.delete()
     ok_(not NGReport.objects.filter(event=event, user=user).exists())
開發者ID:josephbosire,項目名稱:remo,代碼行數:11,代碼來源:test_models.py

示例4: test_create_passive_event_attendance_report

# 需要導入模塊: from remo.events.tests import AttendanceFactory [as 別名]
# 或者: from remo.events.tests.AttendanceFactory import create [as 別名]
    def test_create_passive_event_attendance_report(self):
        """Test creating a passive report after attending an event."""
        event = EventFactory.create()
        user = UserFactory.create(groups=['Rep', 'Mentor'],
                                  userprofile__initial_council=True)
        AttendanceFactory.create(event=event, user=user)
        report = NGReport.objects.get(event=event, user=user)

        eq_(report.mentor, user.userprofile.mentor)
        eq_(report.activity.name, EVENT_ATTENDANCE_ACTIVITY)
        eq_(report.latitude, event.lat)
        eq_(report.longitude, event.lon)
        eq_(report.location, event.venue)
        eq_(report.is_passive, True)
        eq_(report.link, get_event_link(event))
        eq_(report.activity_description, event.description)
        self.assertQuerysetEqual(report.functional_areas.all(),
                                 [e.name for e in event.categories.all()],
                                 lambda x: x.name)
開發者ID:josephbosire,項目名稱:remo,代碼行數:21,代碼來源:test_models.py

示例5: test_delete_attendance

# 需要導入模塊: from remo.events.tests import AttendanceFactory [as 別名]
# 或者: from remo.events.tests.AttendanceFactory import create [as 別名]
 def test_delete_attendance(self):
     """Test delete passive report after attendance delete."""
     activity = Activity.objects.get(name=ACTIVITY_EVENT_ATTEND)
     event = EventFactory.create()
     user = UserFactory.create(groups=['Rep', 'Mentor'],
                               userprofile__initial_council=True)
     attendance = AttendanceFactory.create(event=event, user=user)
     ok_(NGReport.objects.filter(event=event, user=user).exists())
     attendance.delete()
     query = NGReport.objects.filter(event=event, user=user,
                                     activity=activity)
     ok_(not query.exists())
開發者ID:Josespaul,項目名稱:remo,代碼行數:14,代碼來源:test_models.py


注:本文中的remo.events.tests.AttendanceFactory.create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。