@mock.patch("h.nipsa.models.NipsaUser")
def test_add_nipsa_schedules_task_when_user_already_exists(NipsaUser, worker):
    nipsa_user = mock.Mock()
    NipsaUser.get_by_userid.return_value = nipsa_user
    request = mock.Mock()

    logic.add_nipsa(request=request, userid="test_id")

    worker.add_nipsa.delay.assert_called_once_with("test_id")
    NipsaUser.get_by_userid.assert_called_once_with("test_id")
Configured user model.
dataset/ETHPy150Open hypothesis/h/h/nipsa/test/logic_test.py/test_add_nipsa_schedules_task_when_user_already_exists--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/lib/webapp2-2.3/webapp2_extras/auth.py/AuthStore.user_model