def setUp(self):
        self.central_site = create_default_site()

        # Add default permissions
        self.permission_sherpa = get_permission(name='sherpa/user')
        self.permission_sherpa_admin = get_permission(name='sherpa/admin')

        # Create user with sherpa-admin permission
        self.user_sherpaadmin = user_nonmember(identifier='456')
        self.user_sherpaadmin.save()
        create_permission_grant(
            user=self.user_sherpaadmin,
            user_permission=self.permission_sherpa
        )
        create_permission_grant(
            user=self.user_sherpaadmin,
            user_permission=self.permission_sherpa_admin
        )

        # Create user without sherpa-admin permission
        self.user_not_sherpaadmin = user_nonmember(identifier='123')
        self.user_not_sherpaadmin.save()
        create_permission_grant(
            user=self.user_not_sherpaadmin,
            user_permission=self.permission_sherpa
        )
    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()
Beispiel #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()
Beispiel #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()
Beispiel #5
0
    def setUp(self):
        self.user = user_nonmember(identifier='foo')

        self.charge = charge(self.user)
        self.charge.amount = 10000
        self.charge.fee = 440

        self.charge_error_api_cnxn = charge(self.user)
        self.charge_error_api_cnxn.amount = 50000
        self.charge_error_api_cnxn.error_type = 'api_connection_error'
        self.charge_error_api_cnxn.error_message = 'Failure to connect to Stripe\'s API.'

        self.charge_error_card = charge(self.user)
        self.charge_error_card.amount = 50000
        self.charge_error_card.error_type = 'card_error'
        self.charge_error_card.error_code = 'invalid_number'
        self.charge_error_card.error_message = 'The card number is not a valid credit card number.'
Beispiel #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()
Beispiel #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()