Пример #1
0
    def setUp(self):
        # Create a user to act as owner for CMS content, and with Sherpa
        # permission for login tests
        self.user = user_nonmember(identifier='testuser')
        self.user.save()

        self.user_permission = get_permission('sherpa/user')
        self.user_permission_grant = create_permission_grant(
            user=self.user,
            user_permission=self.user_permission
        )

        with Replace('turbasen.Gruppe', Gruppe):
            self.forening = forening()
            self.forening.save()

        self.central_site = create_default_site()

        self.local_site = site(self.forening)
        self.local_site.domain = 'www.dntoslo.no'
        self.local_site.save()

        self.page = page(created_by=self.user, site=self.central_site)
        self.page.save()
        self.version = version(owner=self.user, page=self.page)
        self.version.save()
Пример #2
0
    def setUp(self):
        # Create aktivitet and date objects. PKs are set explicitly to ensure
        # the dates primary keys aren't equal, because we're not testing for
        # primary key collision here.

        self.aktivitet = aktivitet()

        # Aktivitet needs organizer in order to render
        with Replace('turbasen.Gruppe', Gruppe):
            self.forening = forening()
            self.forening.save()
        self.aktivitet.organizer_forening = self.forening
        self.aktivitet.id = 1
        self.aktivitet.save()

        self.aktivitet_date = aktivitet_date(self.aktivitet)

        # Aktivitet date needs dates to be saved.
        # Should be in the future to test signup.
        self.aktivitet_date.start_date = date(date.today().year + 1, 1, 1)
        self.aktivitet_date.end_date = date(date.today().year + 1, 1, 2)
        self.aktivitet_date.id = 2
        self.aktivitet_date.save()

        # Need a site to perform requests
        self.central_site = create_default_site()
Пример #3
0
    def setUp(self):
        # A Settings object is needed for middleware during request tests
        settings().save()

        # Create a user to act as owner for CMS content, and with Sherpa permission for login tests
        self.user = user_nonmember(identifier='testuser')
        self.user.save()
        self.permission = permission(name='sherpa')
        self.permission.save()
        self.user.permissions.add(self.permission)

        with Replace('turbasen.Gruppe', Gruppe):
            self.forening = forening()
            self.forening.save()

        self.central_site = site(self.forening)
        self.central_site.id = Site.DNT_CENTRAL_ID
        self.central_site.domain = 'www.dnt.no'
        self.central_site.save()

        self.local_site = site(self.forening)
        self.local_site.domain = 'www.dntoslo.no'
        self.local_site.save()

        self.page = page(created_by=self.user, site=self.central_site)
        self.page.save()
        self.version = version(owner=self.user, page=self.page)
        self.version.save()
Пример #4
0
    def setUp(self):
        self.user_nonmember = user_nonmember(identifier='foo')

        self.user_pending_member = user_pending_member(memberid=123)
        self.user_pending_member.save()
        self.zipcode = zipcode()
        self.zipcode.save()
        self.enrollment = enrollment(self.user_pending_member.memberid, self.zipcode)
        self.enrollment.save()

        self.user_member = user_member(memberid=456)
        self.user_member.save()
        self.actor = actor(memberid=self.user_member.memberid)
        self.actor.main_forening_id = 1
        self.actor.save()
        self.forening = forening()
        self.forening.focus_id = self.actor.main_forening_id
        self.forening.save()
        self.actor_service = actor_service(actor=self.actor, code=101)
        self.actor_service.save()
        self.zipcode = zipcode()
        self.zipcode.save()
        self.actor_address = actor_address(self.actor, self.zipcode)
        self.actor_address.save()
        self.focus_country = focus_country()
        self.focus_country.code = self.actor_address.country_code
        self.focus_country.save()
        self.balance = balance(self.actor)
        self.balance.current_year = 0
        self.balance.save()
Пример #5
0
 def setUp(self):
     with Replace('turbasen.Gruppe', Gruppe):
         self.forening = forening()
         self.forening.save()
     self.central_site = site(self.forening)
     self.central_site.id = Site.DNT_CENTRAL_ID
     self.central_site.type = 'sentral'
     self.central_site.save()
Пример #6
0
    def setUp(self):
        self.user = user_nonmember(identifier='testuser')
        self.user.save()

        with Replace('turbasen.Gruppe', Gruppe):
            self.forening = forening()
            self.forening.save()

        self.aktivitet = aktivitet()
        self.aktivitet.organizer_forening = self.forening
        self.aktivitet.save()

        self.aktivitet_date = aktivitet_date(self.aktivitet)
        self.aktivitet_date.start_date = date.today() + timedelta(days=1)
        self.aktivitet_date.end_date = date.today() + timedelta(days=2)
        self.aktivitet_date.signup_terms_source = 'general'
        self.aktivitet_date.save()

        self.site = create_default_site()
Пример #7
0
    def setUp(self):
        # Create an article with required dependencies
        self.user = user_nonmember(identifier='foo')
        self.user.save()
        with Replace('turbasen.Gruppe', Gruppe):
            self.forening = forening()
            self.forening.save()
        self.site = site(self.forening)
        self.site.save()
        self.article = article(created_by=self.user, site=self.site)
        self.article.save()

        # Create content with empty title
        self.version = version(owner=self.user, article=self.article)
        self.version.save()
        self.row = row(self.version)
        self.row.save()
        self.column = column(self.row)
        self.column.save()
        self.content = content(self.column)
        self.content.type = 'title'
        self.content.content = ''
        self.content.save()