def test_standard(self): from zope.component import getUtility from z3c.appconfig.interfaces import IAppConfig from zope.publisher.browser import TestRequest config = getUtility(IAppConfig) del config['euphorie']['client'] context = self.setup_context() request = TestRequest() request.client = self.portal.client response = self.export_image(context, request, 'image', 'caption', width=100, height=100) self.assertEqual( set(response), set(['thumbnail', 'original', 'caption'])) self.assertTrue(response['thumbnail'] .startswith('http://nohost/plone/client/nl')) self.assertTrue(response['original'] .startswith('http://nohost/plone/client/nl')) self.assertEqual(response['caption'], u'Caption')
def test_do_POST_survey_with_profile(self): from z3c.saconfig import Session from AccessControl.SecurityManagement import newSecurityManager from zope.publisher.browser import TestRequest from euphorie.content.tests.utils import PROFILE_SURVEY from euphorie.client.model import SurveySession from euphorie.client.tests.utils import addSurvey from euphorie.client.tests.utils import addAccount account = addAccount() self.loginAsPortalOwner() addSurvey(self.portal, PROFILE_SURVEY) request = TestRequest() request.client = self.portal.client survey = self.portal.client['nl']['ict']['software-development'] view = self.View(survey, request) view.input = {'survey': 'nl/ict/software-development'} newSecurityManager(None, account) response = view.do_POST() self.assertTrue(response['next-step'].endswith('profile')) survey_session = Session.query(SurveySession).first() self.assertTrue(not survey_session.hasTree())
def test_do_POST_survey_with_profile(self): from z3c.saconfig import Session from AccessControl.SecurityManagement import newSecurityManager from zope.publisher.browser import TestRequest from euphorie.content.tests.utils import PROFILE_SURVEY from euphorie.client.model import SurveySession from euphorie.client.tests.utils import addSurvey from euphorie.client.tests.utils import addAccount account = addAccount() self.loginAsPortalOwner() addSurvey(self.portal, PROFILE_SURVEY) request = TestRequest() request.client = self.portal.client survey = self.portal.client['nl']['ict']['software-development'] view = self.View(survey, request) view.input = {'survey': 'nl/ict/software-development'} newSecurityManager(None, account) response = view.do_POST() self.assertTrue( response['next-step'].endswith('profile')) survey_session = Session.query(SurveySession).first() self.assertTrue(not survey_session.hasTree())
def test_standard(self): from zope.component import getUtility from z3c.appconfig.interfaces import IAppConfig from zope.publisher.browser import TestRequest config = getUtility(IAppConfig) del config['euphorie']['client'] context = self.setup_context() request = TestRequest() request.client = self.portal.client response = self.export_image(context, request, 'image', 'caption', width=100, height=100) self.assertEqual(set(response), set(['thumbnail', 'original', 'caption'])) self.assertTrue( response['thumbnail'].startswith('http://nohost/plone/client/nl')) self.assertTrue( response['original'].startswith('http://nohost/plone/client/nl')) self.assertEqual(response['caption'], u'Caption')
def test_do_POST_survey_specify_title(self): from z3c.saconfig import Session from AccessControl.SecurityManagement import newSecurityManager from zope.publisher.browser import TestRequest from euphorie.content.tests.utils import BASIC_SURVEY from euphorie.client.model import SurveySession from euphorie.client.tests.utils import addSurvey from euphorie.client.tests.utils import addAccount account = addAccount() self.loginAsPortalOwner() addSurvey(self.portal, BASIC_SURVEY) request = TestRequest() request.client = self.portal.client survey = self.portal.client['nl']['ict']['software-development'] view = self.View(survey, request) view.input = {'survey': 'nl/ict/software-development', 'title': u'Alternative title'} newSecurityManager(None, account) response = view.do_POST() self.assertTrue( response['next-step'].endswith('identification')) survey_session = Session.query(SurveySession).first() self.assertEqual(survey_session.title, u'Alternative title')
def test_do_POST_survey_specify_title(self): from z3c.saconfig import Session from AccessControl.SecurityManagement import newSecurityManager from zope.publisher.browser import TestRequest from euphorie.content.tests.utils import BASIC_SURVEY from euphorie.client.model import SurveySession from euphorie.client.tests.utils import addSurvey from euphorie.client.tests.utils import addAccount account = addAccount() self.loginAsPortalOwner() addSurvey(self.portal, BASIC_SURVEY) request = TestRequest() request.client = self.portal.client survey = self.portal.client['nl']['ict']['software-development'] view = self.View(survey, request) view.input = { 'survey': 'nl/ict/software-development', 'title': u'Alternative title' } newSecurityManager(None, account) response = view.do_POST() self.assertTrue(response['next-step'].endswith('identification')) survey_session = Session.query(SurveySession).first() self.assertEqual(survey_session.title, u'Alternative title')