 					password: @password
 			}, (error, response, body) =>
 				return callback(error) if error?
-				callback()
+				db.users.findOne {email: @email}, (error, user) =>
+					return callback(error) if error?
+					@id = user?._id?.toString()
+					callback()
 	
 	createProject: (name, callback = (error, project_id) ->) ->
 		@request.post {

				done()
				
		it "should allow the owner read access to it", (done) ->
			expect_read_access @owner.request, @project_id, done
			
		it "should allow the owner write access to its settings", (done) ->
			expect_settings_write_access @owner.request, @project_id, done
		
		it "should allow the owner admin access to it", (done) ->
			expect_admin_access @owner.request, @project_id, done
			
		it "should not allow another user read access to it", (done) ->
			expect_no_read_access @other1.request, @project_id, redirect_to: "/restricted", done
			
		it "should not allow another user write access to its settings", (done) ->
			expect_no_settings_write_access @other1.request, @project_id, redirect_to: "/restricted", done
			
		it "should not allow another user admin access to it", (done) ->
			expect_no_admin_access @other1.request, @project_id, redirect_to: "/restricted", done
			
		it "should not allow anonymous user read access to it", (done) ->
			expect_no_read_access @other1.request, @project_id, redirect_to: "/restricted", done
			
		it "should not allow anonymous user write access to its settings", (done) ->
			expect_no_settings_write_access @other1.request, @project_id, redirect_to: "/restricted", done
			
		it "should not allow anonymous user admin access to it", (done) ->
			expect_no_admin_access @other1.request, @project_id, redirect_to: "/restricted", done

	describe "shared project", ->
		before (done) ->

request = require("request")
expect = require("chai").expect
async = require "async"
settings = require("settings-sharelatex")
{db} = require("../../../app/js/infrastructure/mongojs")

count = 0
BASE_URL = "http://localhost:3000"
