本文整理汇总了Python中voteit.core.testing_helpers.bootstrap_and_fixture函数的典型用法代码示例。如果您正苦于以下问题:Python bootstrap_and_fixture函数的具体用法?Python bootstrap_and_fixture怎么用?Python bootstrap_and_fixture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bootstrap_and_fixture函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _fixture
def _fixture(self):
from voteit.core.models.proposal import Proposal
self.config.include('voteit.core.testing_helpers.register_catalog')
self.config.include('voteit.core.testing_helpers.register_security_policies')
root = bootstrap_and_fixture(self.config)
root['p'] = Proposal()
return root['p']
示例2: _fixture
def _fixture(self):
from voteit.core.testing_helpers import bootstrap_and_fixture
from voteit.core.testing_helpers import register_catalog
self.config.registry.settings['default_timezone_name'] = "Europe/Stockholm"
register_catalog(self.config)
root = bootstrap_and_fixture(self.config)
return root
示例3: test_meeting_state
def test_meeting_state(self):
from voteit.core.models.meeting import Meeting
root = bootstrap_and_fixture(self.config)
meeting = root['m'] = Meeting()
request = testing.DummyRequest()
obj = self._cut(meeting, request)
self.assertEqual(obj.meeting_state, u'upcoming')
示例4: _fixture
def _fixture(self):
from voteit.core.models.meeting import Meeting
from voteit.core.models.user import User
root = bootstrap_and_fixture(self.config)
root['m'] = meeting = Meeting()
root.users['dummy'] = User()
return meeting
示例5: test_show_moderator_actions
def test_show_moderator_actions(self):
#FIXME: We still need a functional test for this
root = bootstrap_and_fixture(self.config)
self.config.testing_securitypolicy('admin', permissive = True)
request = testing.DummyRequest()
obj = self._cut(root, request)
self.assertTrue(obj.show_moderator_actions)
示例6: _setup_poll_fixture
def _setup_poll_fixture(config):
config.testing_securitypolicy('admin', permissive = True)
config.include('pyramid_chameleon')
#Register plugin
config.include('voteit.schulze')
config.include('voteit.core.helpers')
config.include('voteit.core.testing_helpers.register_catalog')
root = bootstrap_and_fixture(config)
root['m'] = Meeting()
unrestricted_wf_transition_to(root['m'], 'ongoing')
root['m']['ai'] = ai = AgendaItem()
unrestricted_wf_transition_to(ai, 'upcoming')
unrestricted_wf_transition_to(ai, 'ongoing')
#Setup poll
ai['poll'] = Poll()
poll = ai['poll']
#Add proposals
p1 = Proposal(creators = ['dummy'], text = 'first proposal')
p1.uid = 'p1uid' #To make it simpler to test against
ai['p1'] = p1
p2 = Proposal(creators = ['dummy'], text = 'second proposal')
p2.uid = 'p2uid'
ai['p2'] = p2
p3 = Proposal(creators = ['dummy'], text = 'third proposal')
p3.uid = 'p3uid'
ai['p3'] = p3
#Select proposals for this poll
poll.proposal_uids = (p1.uid, p2.uid, p3.uid)
#Set poll as ongoing
unrestricted_wf_transition_to(poll, 'upcoming')
unrestricted_wf_transition_to(poll, 'ongoing')
return poll
示例7: _fixture
def _fixture(self):
from voteit.core.models.meeting import Meeting
from voteit.core.models.user import User
root = bootstrap_and_fixture(self.config)
root['m'] = Meeting()
root['users']['dummy'] = User(first_name = 'John', last_name = 'Doe')
return root
示例8: test_get_user_by_email
def test_get_user_by_email(self):
self.config.include('arche.models.catalog')
root = bootstrap_and_fixture(self.config)
from voteit.core.models.user import User
obj = root['users']
obj['user'] = User(email = '[email protected]', first_name = 'Anders')
res = obj.get_user_by_email('[email protected]')
self.assertEqual(res.first_name, 'Anders')
示例9: _fixture
def _fixture(self):
from voteit.core.models.agenda_item import AgendaItem
from voteit.core.models.meeting import Meeting
from voteit.core.models.proposal import Proposal
root = bootstrap_and_fixture(self.config)
root['m'] = meeting = Meeting()
meeting['ai'] = ai = AgendaItem()
return ai
示例10: _fixture
def _fixture(self):
from voteit.core.models.agenda_item import AgendaItem
from voteit.core.models.meeting import Meeting
root = bootstrap_and_fixture(self.config)
root['users']['admin'].email = '[email protected]'
root['m'] = meeting = Meeting()
meeting['ai'] = ai = AgendaItem()
return ai
示例11: test_action_contact_no_meeting
def test_action_contact_no_meeting(self):
context = bootstrap_and_fixture(self.config)
request = testing.DummyRequest()
va = self._va()
api = self._api(context, request)
from voteit.core.views.components.help_actions import action_contact
response = action_contact(context, request, va, api=api)
self.assertEqual('', response)
示例12: _fixture
def _fixture(self):
self.config.include('arche.testing')
self.config.registry.settings['voteit.liquid.type'] = 'simple'
self.config.include('voteit.liquid')
self.config.testing_securitypolicy('jane', permissive = True)
root = bootstrap_and_fixture(self.config)
root['m'] = Meeting()
return root['m']
示例13: _fixture
def _fixture(config):
from voteit.core.models.meeting import Meeting
config.testing_securitypolicy(userid='dummy', permissive=True)
config.include('voteit.core.testing_helpers.register_catalog')
root = bootstrap_and_fixture(config)
root['users']['admin'].set_field_value('about_me', u"The story of an administrator")
root['m'] = Meeting()
return root
示例14: test_navigation_section_root
def test_navigation_section_root(self):
self.config.testing_securitypolicy(userid="dummy", permissive=True)
context = bootstrap_and_fixture(self.config)
request = testing.DummyRequest()
va = _va(title="Upcoming", state="upcoming")
api = _api(context, request)
response = self._fut(context, request, va, api=api)
self.assertIn("Upcoming", response)
示例15: test_get_userinfo_url
def test_get_userinfo_url(self):
from voteit.core.models.meeting import Meeting
root = bootstrap_and_fixture(self.config)
meeting = root['m'] = Meeting()
request = testing.DummyRequest()
obj = self._cut(meeting, request)
#example.com is from Pyramids testing suite
self.assertEqual(obj.get_userinfo_url('somebody'), 'http://example.com/m/_userinfo?userid=somebody')