The referential integrity constraint violation seems to indicate you are trying to create a task but the user that the task is assigned to does not exist? What user are you using in your test and is this one of the pre-registered or did you register your custom users?
Kris