def test_eligibility_flowexception_change(self):
        user = TestTools.create_mock_user()
        svcA, svcB = TestTools.create_mock_services()
        recA = TestTools.create_mock_svc_record(svcA)
        recB = TestTools.create_mock_svc_record(svcB)
        act = TestTools.create_blank_activity(svcA, record=recB)
        act.Origin = recB
        act.UIDs = set([act.UID])
        act.Record = ActivityRecord.FromActivity(act)

        recipientServices = [recA]
        s = SynchronizationTask(None)
        s._excludedServices = {}
        s.user = user
        s._serviceConnections = [recA, recB]

        User.SetFlowException(user, recA, recB, flowToSource=False, flowToTarget=True)
        eligible = s._determineEligibleRecipientServices(act, recipientServices)
        self.assertTrue(recA not in eligible)
        self.assertTrue(recB not in eligible)

        recipientServices = [recB]
        act.Origin = recA
        act.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcA, record=recA)
        User.SetFlowException(user, recA, recB, flowToSource=True, flowToTarget=False)
        eligible = s._determineEligibleRecipientServices(act, recipientServices)
        self.assertTrue(recA not in eligible)
        self.assertTrue(recB not in eligible)

        User.SetFlowException(user, recA, recB, flowToSource=False, flowToTarget=False)
        eligible = s._determineEligibleRecipientServices(act, recipientServices)
        self.assertTrue(recA not in eligible)
        self.assertTrue(recB not in eligible)

        recipientServices = [recA, recB]
        User.SetFlowException(user, recA, recB, flowToSource=True, flowToTarget=True)
        eligible = s._determineEligibleRecipientServices(act, recipientServices)
        self.assertTrue(recA in eligible)
        self.assertTrue(recB in eligible)

        eligible = s._determineEligibleRecipientServices(act, recipientServices)
        self.assertTrue(recA in eligible)
        self.assertTrue(recB in eligible)
dataset/ETHPy150Open cpfair/tapiriik/tapiriik/testing/sync.py/SyncTests.test_eligibility_flowexception_change/original