diff --git a/spec/integration/api/v1/vm_spec.rb b/spec/integration/api/v1/vm_spec.rb index 387ecd0..d012d43 100644 --- a/spec/integration/api/v1/vm_spec.rb +++ b/spec/integration/api/v1/vm_spec.rb @@ -39,6 +39,26 @@ describe Vmpooler::API::V1 do create_token('abcdefghijklmnopqrstuvwxyz012345', 'jdoe', current_time) end + describe 'GET /vm/:hostname' do + it 'returns correct information on a running vm' do + create_running_vm 'pool1', 'abcdefghijklmnop' + get "#{prefix}/vm/abcdefghijklmnop" + expect_json(ok = true, http = 200) + expected = { + ok: true, + abcdefghijklmnop: { + template: "pool1", + lifetime: 0, + running: "00h 00m ..s", + time_remaining: "00h ..m ..s", + state: "running", + ip: "" + } + } + expect(last_response.body).to match(JSON.pretty_generate(expected)) + end + end + describe 'POST /vm' do it 'returns a single VM' do create_ready_vm 'pool1', 'abcdefghijklmnop'