 				done()
 
 		it "should return the error", (done)->
-			@request.get = sinon.stub().callsArgWith(1, @error, {}, {})
+			@request.get = sinon.stub().callsArgWith(1, @stubbedError, {}, {})
 			@requires["request"] = @request
 			@DocArchiveManager = SandboxedModule.require modulePath, requires: @requires
 
 			@DocArchiveManager.unarchiveDoc @project_id, @docs[0], (err)=>
-				err.should.equal @error
+				should.exist err
 				done()
 
 	describe "archiveAllDocs", ->

				opts.uri.should.equal "https://#{@settings.filestore.stores.user_files}.s3.amazonaws.com/#{@project_id}/#{@docs[0]._id}"
				done()

		it "should return the error", (done)->
			@request.put = sinon.stub().callsArgWith(1, @error, {})
			@requires["request"] = @request
			@DocArchiveManager = SandboxedModule.require modulePath, requires: @requires

			@DocArchiveManager.archiveDoc @project_id, @docs[0], (err)=>
				err.should.equal @error
				done()

	describe "unarchiveDoc", ->


		@error = "my errror"
		@project_id = ObjectId().toString()
		@stubbedError = new Errors.NotFoundError("Error in S3 request")

	describe "archiveDoc", ->

		it "should use correct options", (done)->
			@request.put = sinon.stub().callsArgWith(1,  null, {statusCode:200,headers:{etag:""}})
			@requires["request"] = @request
			@DocArchiveManager = SandboxedModule.require modulePath, requires: @requires

