本文整理汇总了Python中tests.unittests.object_mother.ObjectMother.get_event方法的典型用法代码示例。如果您正苦于以下问题:Python ObjectMother.get_event方法的具体用法?Python ObjectMother.get_event怎么用?Python ObjectMother.get_event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.unittests.object_mother.ObjectMother
的用法示例。
在下文中一共展示了ObjectMother.get_event方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_event_copy
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_event [as 别名]
def test_event_copy(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
url = url_for('events.copy_event', event_id=event.id)
rv = self.app.get(url, follow_redirects=True)
self.assertTrue("Copy of event1" in rv.data, msg=rv.data)
示例2: test_wrong_form_config
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_event [as 别名]
def test_wrong_form_config(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
url = url_for('event_sessions.create_view', event_id=event.id)
rv = self.app.get(url, follow_redirects=True)
self.assertFalse("incorrectly configured" in rv.data, msg=rv.data)
示例3: test_unpublished_event_view_attempt
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_event [as 别名]
def test_unpublished_event_view_attempt(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event Saved")
rv = self.app.get(url_for('event_detail.display_event_detail_home', identifier=event.identifier),
follow_redirects=True)
self.assertEqual(rv.status_code, 404)
示例4: test_event_delete
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_event [as 别名]
def test_event_delete(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
url = url_for('events.trash_view', event_id=event.id)
rv = self.app.get(url, follow_redirects=True)
self.assertTrue("Your event has been deleted" in rv.data, msg=rv.data)
示例5: test_scheduler_publish
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_event [as 别名]
def test_scheduler_publish(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
rv = self.app.get(url_for('event_scheduler.publish', event_id=event.id), follow_redirects=True)
event = DataGetter.get_event(event.id)
self.assertTrue(event.schedule_published_on is not None, msg=rv.data)
示例6: get_event_ticket
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_event [as 别名]
def get_event_ticket():
set_settings(paypal_mode='sandbox',
paypal_sandbox_username=environ.get('PAYPAL_SANDBOX_USERNAME', 'SQPTVKtS8YvItGQuvHFvwve4'),
paypal_sandbox_password=environ.get('PAYPAL_SANDBOX_PASSWORD', 'SQPTVKtS8YvItGQuvHFvwve4'),
paypal_sandbox_signature=environ.get('PAYPAL_SANDBOX_SIGNATURE', 'SQPTVKtS8YvItGQuvHFvwve4'),
secret='super secret key')
event = ObjectMother.get_event()
event.name = 'Super Event'
event.state = 'Published'
event.paypal_email = '[email protected]'
save_to_db(event, "Event Saved")
stripe_auth = StripeAuthorization(
stripe_secret_key=environ.get('STRIPE_SECRET_KEY', 'sk_test_SQPTVKtS8YvItGQuvHFvwve4'),
stripe_refresh_token=environ.get('STRIPE_REFRESH_TOKEN', 'sk_test_SQPTVKtS8YvItGQuvHFvwve4'),
stripe_publishable_key=environ.get('STRIPE_PUBLISHABLE_KEY', 'pk_test_e2jsd4RNUlYesCUb2KJ9nkCm'),
stripe_user_id=environ.get('STRIPE_USER_ID', '1445522255'),
stripe_email=environ.get('STRIPE_EMAIL', '[email protected]'),
event_id=event.id
)
save_to_db(stripe_auth, "StripeAuthorization Saved")
ticket = Ticket(name='Test Ticket',
type='paid',
sales_start=datetime.now() - timedelta(days=5),
sales_end=datetime.now() + timedelta(days=5),
description="SomeTicket",
event=event,
price=50)
save_to_db(ticket, "Ticket Saved")
save_to_db(Module(ticket_include=True, payment_include=True, donation_include=True))
return event, ticket
示例7: test_speakers_list
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_event [as 别名]
def test_speakers_list(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
url = url_for('event_speakers.index_view', event_id=event.id)
rv = self.app.get(url, follow_redirects=True)
self.assertTrue("Speakers" in rv.data, msg=rv.data)
示例8: test_event_publish
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_event [as 别名]
def test_event_publish(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
url = url_for('events.publish_event', event_id=event.id)
rv = self.app.get(url, follow_redirects=True)
event = DataGetter.get_event(event.id)
self.assertEqual("Published", event.state, msg=event.state)
示例9: test_published_event_view
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_event [as 别名]
def test_published_event_view(self):
with app.test_request_context():
event = ObjectMother.get_event()
event.state = 'Published'
save_to_db(event, "Event Saved")
rv = self.app.get(url_for('event_detail.display_event_detail_home', identifier=event.identifier),
follow_redirects=True)
self.assertTrue("Open Event" in rv.data, msg=rv.data)
示例10: test_session_create
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_event [as 别名]
def test_session_create(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
custom_form = ObjectMother.get_custom_form(event.id)
save_to_db(custom_form, "Custom form saved")
url = url_for('event_sessions.create_view', event_id=event.id)
rv = self.app.get(url, follow_redirects=True)
self.assertTrue("Create Session" in rv.data, msg=rv.data)
示例11: test_session_delete
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_event [as 别名]
def test_session_delete(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event Saved")
session = ObjectMother.get_session()
save_to_db(session, "Session Saved")
url = url_for('event_sessions.delete_session', event_id=1, session_id=session.id)
rv = self.app.get(url, follow_redirects=True)
self.assertTrue("deleted" in rv.data, msg=rv.data)
示例12: test_published_event_view_coc
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_event [as 别名]
def test_published_event_view_coc(self):
with app.test_request_context():
event = ObjectMother.get_event()
event.state = 'Published'
event.code_of_conduct = 'Test Code of Conduct'
save_to_db(event, "Event Saved")
rv = self.app.get(url_for('event_detail.display_event_coc', identifier=event.identifier),
follow_redirects=True)
self.assertTrue("Code of Conduct" in rv.data, msg=rv.data)
示例13: get_event
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_event [as 别名]
def get_event():
event = ObjectMother.get_event()
event.name = 'Super Event'
event.start_time = datetime.now() + timedelta(days=5)
event.end_time = event.start_time + timedelta(days=5)
event.location_name = 'India'
event.searchable_location_name = 'India'
event.state = 'Published'
return event
示例14: test_wrong_form_config
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_event [as 别名]
def test_wrong_form_config(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
speaker = ObjectMother.get_speaker()
speaker.event_id = event.id
save_to_db(speaker, "Speaker saved")
url = url_for('event_speakers.edit_view', event_id=event.id, speaker_id=speaker.id)
rv = self.app.get(url, follow_redirects=True)
self.assertFalse("incorrectly configured" in rv.data, msg=rv.data)
示例15: test_api_tracks
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_event [as 别名]
def test_api_tracks(self):
with app.test_request_context():
self.assertEqual(self.app.get('/api/v1/event/1').status_code, 404)
event = ObjectMother.get_event()
track = ObjectMother.get_track()
save_to_db(event, "Event saved")
save_to_db(track, "Track saved")
self.assertEqual(self.app.get('/api/v1/event/1').status_code, 200)
self.assertEqual(self.app.get('/api/v1/event/1/tracks').status_code, 200)