@defer.inlineCallbacks
    def test_invalid_login(self):
        self.runtime_environment.configure()
        cm = self.runtime_environment.configuration_manager
        dm = self.runtime_environment.dependency_manager

        self.create_pb_server(checker=dict(
            name = 'twisted.cred.checkers.InMemoryUsernamePasswordDatabaseDontUse',
            arguments = dict(test_username='test_password')
        ))

        cm.set('pb.clients.test_wrong_password_client', dict(
            endpoint = self.port%'tcp:host=localhost:port=%i',
            username = 'test_username',
            password = 'wrong_password'
        ))

        cm.set('pipelines.test_pipeline', ['passthrough'])

        pp = pipeline_provider.PipelineProvider()
        pp.configure(self.runtime_environment)

        self.application.startService()
        self.addCleanup(self.application.stopService)

        client_provider = spread_provider.PBClientProvider()
        client_provider.configure(self.runtime_environment)

        self.replace_twisted_log_err()

        with mock.patch.object(spread_provider, 'logger') as mocked_logger:
            client_wrong_password_factory_dependency = dm.add_dependency(self, dict(provider='pb.client.test_wrong_password_client'))
            dm.resolve_initial_states()

            # trying to log in with an unauthorized login should result in an "unauthorized login"
            wrong_pw_factory = yield client_wrong_password_factory_dependency.wait_for_resource()
            (args, kwargs) = yield wrong_pw_factory.on_failed_getting_root_object.wait_until_fired()
            reason = args[0]

            self.assertEquals(reason.type, 'twisted.cred.error.UnauthorizedLogin')
            yield util.wait(0) # wait a reactor iteration so the event finishes processing
dataset/ETHPy150Open foundit/Piped/piped/providers/test/test_spread_provider.py/PBClientTest.test_invalid_login/swapped operands of `%`