本文整理汇总了Python中tapiriik.testing.testtools.TestTools.create_mock_service方法的典型用法代码示例。如果您正苦于以下问题:Python TestTools.create_mock_service方法的具体用法?Python TestTools.create_mock_service怎么用?Python TestTools.create_mock_service使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tapiriik.testing.testtools.TestTools
的用法示例。
在下文中一共展示了TestTools.create_mock_service方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_eligibility_flowexception_shortcircuit
# 需要导入模块: from tapiriik.testing.testtools import TestTools [as 别名]
# 或者: from tapiriik.testing.testtools.TestTools import create_mock_service [as 别名]
def test_eligibility_flowexception_shortcircuit(self):
user = TestTools.create_mock_user()
svcA, svcB = TestTools.create_mock_services()
svcC = TestTools.create_mock_service("mockC")
recA = TestTools.create_mock_svc_record(svcA)
recB = TestTools.create_mock_svc_record(svcB)
recC = TestTools.create_mock_svc_record(svcC)
act = TestTools.create_blank_activity(svcA, record=recA)
User.SetFlowException(user, recA, recC, flowToTarget=False)
# Behaviour with known origin and no override set
act.Origin = recA
recipientServices = [recC, recB]
excludedServices = []
eligible = Sync._determineEligibleRecipientServices(activity=act, connectedServices=[recA, recB, recC], recipientServices=recipientServices, excludedServices=excludedServices, user=user)
self.assertTrue(recA not in eligible)
self.assertTrue(recB in eligible)
self.assertTrue(recC not in eligible)
# Enable alternate routing
recB.SetConfiguration({"allow_activity_flow_exception_bypass_via_self":True}, no_save=True)
self.assertTrue(recB.GetConfiguration()["allow_activity_flow_exception_bypass_via_self"])
# We should now be able to arrive at recC via recB
act.Origin = recA
recipientServices = [recC, recB]
excludedServices = []
eligible = Sync._determineEligibleRecipientServices(activity=act, connectedServices=[recA, recB, recC], recipientServices=recipientServices, excludedServices=excludedServices, user=user)
self.assertTrue(recA not in eligible)
self.assertTrue(recB in eligible)
self.assertTrue(recC in eligible)
示例2: test_eligibility_flowexception_shortcircuit
# 需要导入模块: from tapiriik.testing.testtools import TestTools [as 别名]
# 或者: from tapiriik.testing.testtools.TestTools import create_mock_service [as 别名]
def test_eligibility_flowexception_shortcircuit(self):
user = TestTools.create_mock_user()
svcA, svcB = TestTools.create_mock_services()
svcC = TestTools.create_mock_service("mockC")
recA = TestTools.create_mock_svc_record(svcA)
recB = TestTools.create_mock_svc_record(svcB)
recC = TestTools.create_mock_svc_record(svcC)
act = TestTools.create_blank_activity(svcA, record=recA)
User.SetFlowException(user, recA, recC, flowToTarget=False)
# Behaviour with known origin and no override set
act.Origin = recA
act.UIDs = set([act.UID])
act.Record = ActivityRecord.FromActivity(act)
recipientServices = [recC, recB]
s = SynchronizationTask(None)
s._excludedServices = {}
s.user = user
s._serviceConnections = [recA, recB, recC]
eligible = s._determineEligibleRecipientServices(act, recipientServices)
self.assertTrue(recA not in eligible)
self.assertTrue(recB in eligible)
self.assertTrue(recC not in eligible)
# Enable alternate routing
# FIXME: This setting doesn't seem to be used anywhere any more?? Test disabled at the end..
recB.SetConfiguration({"allow_activity_flow_exception_bypass_via_self": True}, no_save=True)
self.assertTrue(recB.GetConfiguration()["allow_activity_flow_exception_bypass_via_self"])
# We should now be able to arrive at recC via recB
act.Origin = recA
act.UIDs = set([act.UID])
act.Record = ActivityRecord.FromActivity(act)
recipientServices = [recC, recB]
s._excludedServices = {}
s._serviceConnections = [recA, recB, recC]
eligible = s._determineEligibleRecipientServices(act, recipientServices)
self.assertTrue(recA not in eligible)
self.assertTrue(recB in eligible)