vmware-vra 3.1.2 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,23 +16,23 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
  #
19
- require 'spec_helper'
19
+ require "spec_helper"
20
20
 
21
21
  describe Vra::CatalogType do
22
22
  let(:client) do
23
23
  Vra::Client.new(
24
- username: 'user@corp.local',
25
- password: 'password',
26
- tenant: 'tenant',
27
- base_url: 'https://vra.corp.local'
24
+ username: "user@corp.local",
25
+ password: "password",
26
+ domain: "domain",
27
+ base_url: "https://vra.corp.local"
28
28
  )
29
29
  end
30
30
 
31
31
  let(:sample_data) do
32
- JSON.parse(File.read('spec/fixtures/resource/sample_catalog_type.json'))
32
+ JSON.parse(File.read("spec/fixtures/resource/sample_catalog_type.json"))
33
33
  end
34
34
 
35
- describe '#initialize' do
35
+ describe "#initialize" do
36
36
  let(:cat_type) do
37
37
  described_class.allocate
38
38
  end
@@ -41,74 +41,74 @@ describe Vra::CatalogType do
41
41
  allow(client).to receive(:get_parsed).and_return(sample_data)
42
42
  end
43
43
 
44
- it 'should validate and fetch data' do
44
+ it "should validate and fetch data" do
45
45
  expect(cat_type).to receive(:validate!)
46
46
  expect(cat_type).to receive(:fetch_data)
47
47
 
48
- cat_type.send(:initialize, client, id: 'com.vmw.vro.workflow')
48
+ cat_type.send(:initialize, client, id: "com.vmw.vro.workflow")
49
49
  end
50
50
 
51
- it 'should fetch data when id is passed' do
52
- cat_type.send(:initialize, client, id: 'com.vmw.vro.workflow')
51
+ it "should fetch data when id is passed" do
52
+ cat_type.send(:initialize, client, id: "com.vmw.vro.workflow")
53
53
 
54
54
  expect(cat_type.send(:data)).not_to be_nil
55
55
  end
56
56
 
57
- it 'should set id when data is passed' do
57
+ it "should set id when data is passed" do
58
58
  cat_type.send(:initialize, client, data: sample_data)
59
59
 
60
- expect(cat_type.id).to eq('com.vmw.vro.workflow')
60
+ expect(cat_type.id).to eq("com.vmw.vro.workflow")
61
61
  end
62
62
  end
63
63
 
64
- describe '#validate' do
64
+ describe "#validate" do
65
65
  let(:cat_type) do
66
66
  described_class.allocate
67
67
  end
68
68
 
69
- it 'should raise exception when neither id nor data passed' do
69
+ it "should raise exception when neither id nor data passed" do
70
70
  expect { cat_type.send(:initialize, client) }.to raise_error(ArgumentError)
71
71
  end
72
72
 
73
- it 'should raise exception when both id and data is passed' do
74
- params = [client, { id: 'com.vmw.vra.workflow', data: sample_data }]
73
+ it "should raise exception when both id and data is passed" do
74
+ params = [client, { id: "com.vmw.vra.workflow", data: sample_data }]
75
75
  expect { cat_type.send(:initialize, *params) }.to raise_error(ArgumentError)
76
76
  end
77
77
  end
78
78
 
79
- describe '#fetch_data' do
79
+ describe "#fetch_data" do
80
80
  let(:cat_type) do
81
81
  described_class.allocate
82
82
  end
83
83
 
84
- it 'should fetch the data correctly' do
84
+ it "should fetch the data correctly" do
85
85
  allow(client).to receive(:get_parsed).and_return(sample_data)
86
- cat_type.send(:initialize, client, id: 'com.vmw.vro.workflow')
86
+ cat_type.send(:initialize, client, id: "com.vmw.vro.workflow")
87
87
 
88
88
  data = cat_type.send(:data)
89
89
  expect(data).not_to be_nil
90
- expect(cat_type.id).to eq(data['id'])
91
- expect(data['name']).to eq('vRealize Orchestrator Workflow')
90
+ expect(cat_type.id).to eq(data["id"])
91
+ expect(data["name"]).to eq("vRealize Orchestrator Workflow")
92
92
  end
93
93
 
94
- it 'should raise when catalog with type not found' do
94
+ it "should raise when catalog with type not found" do
95
95
  allow(client).to receive(:get_parsed).and_raise(Vra::Exception::HTTPNotFound)
96
96
 
97
- expect { cat_type.send(:initialize, client, id: sample_data['id']) }
97
+ expect { cat_type.send(:initialize, client, id: sample_data["id"]) }
98
98
  .to raise_error(Vra::Exception::NotFound)
99
- .with_message("catalog type ID #{sample_data['id']} does not exist")
99
+ .with_message("catalog type ID #{sample_data["id"]} does not exist")
100
100
  end
101
101
  end
102
102
 
103
- describe 'attributes' do
104
- it 'should have the correct attributes' do
103
+ describe "attributes" do
104
+ it "should have the correct attributes" do
105
105
  allow(client).to receive(:get_parsed).and_return(sample_data)
106
106
 
107
- cat_type = described_class.new(client, id: sample_data['id'])
108
- expect(cat_type.name).to eq('vRealize Orchestrator Workflow')
109
- expect(cat_type.base_url).to eq('https://vra.corp.local:8080/vro')
110
- expect(cat_type.config_schema).to eq(sample_data['configSchema'])
111
- expect(cat_type.icon_id).to eq('0616ff81-c13b-32fe-b3b9-de3c2edd85dd')
107
+ cat_type = described_class.new(client, id: sample_data["id"])
108
+ expect(cat_type.name).to eq("vRealize Orchestrator Workflow")
109
+ expect(cat_type.base_url).to eq("https://vra.corp.local:8080/vro")
110
+ expect(cat_type.config_schema).to eq(sample_data["configSchema"])
111
+ expect(cat_type.icon_id).to eq("0616ff81-c13b-32fe-b3b9-de3c2edd85dd")
112
112
  end
113
113
  end
114
114
  end