         if opts?.userFormData?
         then callback { client, user, account, group, sessionToken : newToken }
         else callback { client, user, account, group, sessionToken : newToken, userFormData }
+
+
+withCreatedUser = (opts, callback) ->
+
+  [opts, callback] = [callback, opts]  unless callback
+
+  user     = {}
+  account  = {}
+  userInfo = _.extend generateUserInfo(), opts
+
+  withDummyClient opts, ({ client }) ->
+
+    JUser.createUser userInfo, (err, user_, account_) ->
+      expect(err).to.not.exist
+      [user, account] = [user_, account_]
+
+      fetchGroup client, (group) ->
+        callback { client, user, account, group }
 
 
 generateDummyUserFormData = (opts = {}) ->

withDummyClient = (context, callback) ->

  [context, callback] = [callback, context]  unless callback
  context         ?= { group : 'koding' }

  generateDummyClient context, (err, client) ->
    expect(err).to.not.exist

  fetchGroup
  expectRelation
  withDummyClient
  withCreatedUser
  generateUserInfo
  withConvertedUser
  expectAccessDenied
