   
   beforeEach () ->
     sinon.stub cliUtilsStub, 'exit'
-    #sinon.stub cliUtilsStub, 'log'
-    #sinon.stub cliUtilsStub, 'error'
+    sinon.stub cliUtilsStub, 'log'
+    sinon.stub cliUtilsStub, 'error'
     nock.disableNetConnect()
 
   afterEach () -> 
     cliUtilsStub.exit.restore()
-    #cliUtilsStub.log.restore()
-    #cliUtilsStub.error.restore()   
+    cliUtilsStub.log.restore()
+    cliUtilsStub.error.restore()   
     nock.enableNetConnect()
     nock.cleanAll()
 

  data = {}
  server = {}

  describe.only 'backend responds as it should', () ->
    beforeEach () ->
      server = nock('http://localhost:3000').
        post('/machines', {"type":"bulldozer","name":"willy"}).

      executeTransaction transaction, () ->
        assert.notOk cliUtilsStub.exit.called
        done()
  
  describe 'backend responds with non valid response', () ->
    beforeEach () ->
      server = nock('http://localhost:3000').
        post('/machines', {"type":"bulldozer","name":"willy"}).
        reply transaction['response']['status'],
          'Foo bar',
          {'Content-Type': 'text/plain'}


    it 'should perform the request', (done) ->
      executeTransaction transaction, () ->
        assert.ok server.isDone()
        done()

    it 'should exit with status 1', (done) ->
      executeTransaction transaction, () ->
        assert.ok cliUtilsStub.exit.calledWith(1)
        done()
        
  describe 'when dry run', () ->
    before () ->
      transaction['configuration']['dryRun'] = true
