本文整理汇总了Python中voteit.core.testing_helpers.bootstrap_and_fixture函数的典型用法代码示例。如果您正苦于以下问题:Python bootstrap_and_fixture函数的具体用法?Python bootstrap_and_fixture怎么用?Python bootstrap_and_fixture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bootstrap_and_fixture函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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']
开发者ID:tobsan,项目名称:voteit.core,代码行数:7,代码来源:test_unread.py
示例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
开发者ID:tobsan,项目名称:voteit.core,代码行数:7,代码来源:test_unsupported_browser.py
示例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')
开发者ID:tobsan,项目名称:voteit.core,代码行数:7,代码来源:test_api.py
示例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
开发者ID:tobsan,项目名称:voteit.core,代码行数:7,代码来源:test_participants.py
示例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)
开发者ID:tobsan,项目名称:voteit.core,代码行数:7,代码来源:test_api.py
示例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
开发者ID:VoteIT,项目名称:voteit.schulze,代码行数:32,代码来源:tests.py
示例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
开发者ID:tobsan,项目名称:voteit.core,代码行数:7,代码来源:test_transform_at_links.py
示例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')
开发者ID:VoteIT,项目名称:voteit.core,代码行数:8,代码来源:test_users.py
示例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
开发者ID:tobsan,项目名称:voteit.core,代码行数:8,代码来源:test_helpers.py
示例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
开发者ID:VoteIT,项目名称:voteit.core,代码行数:8,代码来源:test_mention.py
示例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)
开发者ID:tobsan,项目名称:voteit.core,代码行数:8,代码来源:test_help_actions.py
示例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']
开发者ID:VoteIT,项目名称:voteit.liquid,代码行数:8,代码来源:tests.py
示例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
开发者ID:waytai,项目名称:voteit.core,代码行数:8,代码来源:test_user_info.py
示例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)
开发者ID:VoteIT,项目名称:voteit.core,代码行数:8,代码来源:test_navigation.py
示例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')
开发者ID:tobsan,项目名称:voteit.core,代码行数:8,代码来源:test_api.py
示例16: _fixture
def _fixture(config):
from voteit.core.models.meeting import Meeting
config.include('arche.testing')
config.include('voteit.core.schemas.contact')
config.include('pyramid_mailer.testing')
root = bootstrap_and_fixture(config)
root['m'] = Meeting()
return root
开发者ID:VoteIT,项目名称:voteit.core,代码行数:8,代码来源:test_contact.py
示例17: test_meeting_url
def test_meeting_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 env
self.assertEqual(obj.meeting_url, 'http://example.com/m/')
开发者ID:tobsan,项目名称:voteit.core,代码行数:8,代码来源:test_api.py
示例18: _fixture
def _fixture(self):
from voteit.core.models.user import User
self.config.scan('voteit.core.schemas.user') #Login / register form
root = bootstrap_and_fixture(self.config)
root.users['dummy1'] = User(title='Dummy 1')
root.users['dummy2'] = User(title='Dummy 2')
root.users['dummy3'] = User(title='Dummy 3', email='[email protected]')
root.users['dummy3'].set_password('dummy1234')
return root
开发者ID:tobsan,项目名称:voteit.core,代码行数:9,代码来源:test_site.py
示例19: _fixture
def _fixture(self):
from voteit.core.models.meeting import Meeting
from voteit.core.models.agenda_item import AgendaItem
from voteit.core.models.user import User
root = bootstrap_and_fixture(self.config)
root.users['some_user'] = User()
root['m'] = Meeting()
root['m']['ai'] = AgendaItem()
return root['m']['ai']
开发者ID:waytai,项目名称:voteit.core,代码行数:9,代码来源:test_inline_add_form.py
示例20: test_copy_users_and_perms
def test_copy_users_and_perms(self):
root = bootstrap_and_fixture(self.config)
root['m1'] = m1 = self._cut()
m1.add_groups('first', ['role:A', 'role:B'])
m1.add_groups('second', ['role:A', 'role:C'])
root['m2'] = m2 = self._cut()
m2.copy_users_and_perms('m1')
self.assertEqual(m1.get_security(), m2.get_security())
self.assertEqual(m2.get_groups('second'), ('role:A', 'role:C'))
开发者ID:tobsan,项目名称:voteit.core,代码行数:9,代码来源:test_meeting.py
注:本文中的voteit.core.testing_helpers.bootstrap_and_fixture函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论