File: ec2_credentials_tests.rb

package info (click to toggle)
ruby-fog-openstack 1.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,784 kB
  • sloc: ruby: 47,937; makefile: 5; sh: 4
file content (43 lines) | stat: -rw-r--r-- 1,304 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require "test_helper"

require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))

describe "Fog::Identity[:openstack] | EC2 credential requests" do
  before do
    @identity = Fog::OpenStack::Identity.new(:openstack_identity_api_version => 'v2.0')

    @credential_format = {
      'access'    => String,
      'tenant_id' => String,
      'secret'    => String,
      'user_id'   => String,
    }

    @user_id = OpenStack::Identity.get_user_id(@identity)
    @tenant_id = OpenStack::Identity.get_tenant_id(@identity)

    @response = @identity.create_ec2_credential(@user_id, @tenant_id)
    @ec2_credential = @response.body['credential']
  end

  describe "success" do
    it "#create_ec2_credential" do
      @response.body.must_match_schema('credential' => @credential_format)
    end

    it "#get_ec2_credential" do
      @identity.get_ec2_credential(@user_id, @ec2_credential['access']).body.
        must_match_schema('credential' => @credential_format)
    end

    it "#list_ec2_credentials" do
      @identity.list_ec2_credentials(@user_id).body.
        must_match_schema('credentials' => [@credential_format])
    end

    it "#delete_ec2_credential" do
      @identity.delete_ec2_credential(@user_id, @ec2_credential['access']).
        status.must_equal 204
    end
  end
end