create('Magento\User\Model\User'); $userName = 'webapi_user'; $model->load($userName, 'username'); $model->delete(); /* Unlock account if it was locked */ /** @var RequestThrottler $throttler */ $throttler = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(RequestThrottler::class); $throttler->resetAuthenticationFailuresCount($userName, RequestThrottler::USER_TYPE_ADMIN);