def testUninstalledGroupModel(self): with self.assertRaises(ImproperlyConfigured): get_group_model()
import calendar from django.test import RequestFactory, TestCase from django.contrib.auth.models import User from django.utils import timezone from wagtail.core.models import Page from ls.joyous.utils.recurrence import Recurrence from ls.joyous.utils.recurrence import WEEKLY, MO, TU, WE, FR from ls.joyous.models.calendar import GeneralCalendarPage from ls.joyous.models.events import (SimpleEventPage, MultidayEventPage, RecurringEventPage, PostponementPage, ExtraInfoPage) from ls.joyous.models.events import (getAllEventsByDay, getAllEventsByWeek, getAllUpcomingEvents, getAllPastEvents, getGroupUpcomingEvents) from ls.joyous.models.groups import get_group_model from .testutils import datetimetz GroupPage = get_group_model() class TestGetEvents(TestCase): def setUp(self): self.home = Page.objects.get(slug='home') self.user = User.objects.create_user('i', '*****@*****.**', 's3cr3t') self.request = RequestFactory().get("/test") self.request.user = self.user self.request.session = {} self.calendar = GeneralCalendarPage(owner = self.user, slug = "events", title = "Events") self.home.add_child(instance=self.calendar) self.group = GroupPage(slug = "initech", title = "Initech Corporation") self.home.add_child(instance=self.group)
def testInvalidGroupModel(self): with self.assertRaises(ImproperlyConfigured): get_group_model()