Don't require username/password authentication for GET /token/:token route

This commit is contained in:
Scott Schneider 2015-11-04 13:19:15 -08:00
parent e0356968df
commit d74c9ff512
3 changed files with 2 additions and 17 deletions

View file

@ -127,19 +127,11 @@ describe Vmpooler::API::V1 do
]
} }
it 'returns a 401 if not authed' do
get "#{prefix}/token/this"
expect_json(ok = false, http = 401)
end
it 'returns a token if authed' do
it 'returns a token' do
expect(redis).to receive(:hgetall).with('vmpooler__token__this').and_return({'user' => 'admin'})
expect(redis).to receive(:smembers).with('vmpooler__running__pool1').and_return(['vmhostname'])
expect(redis).to receive(:hget).with('vmpooler__vm__vmhostname', 'token:token').and_return('this')
authorize 'admin', 's3cr3t'
get "#{prefix}/token/this"
expect(JSON.parse(last_response.body)['ok']).to eq(true)