Skip to content

Commit b13ef59

Browse files
committed
update tests
1 parent 9d585ee commit b13ef59

File tree

6 files changed

+167
-78
lines changed

6 files changed

+167
-78
lines changed

spec/smoke/toll_free_verification_api_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
end
3030
end
3131

32+
# Delete a Toll-Free Verification Submission
33+
describe 'delete_verification_request' do
34+
it 'deletes a toll free verification submission' do
35+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
36+
end
37+
end
38+
3239
# List Toll-Free Use Cases
3340
describe 'list_toll_free_use_cases test' do
3441
it 'lists toll free use cases' do

spec/unit/api/toll_free_verification_api_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@
136136
end
137137
end
138138

139+
# Delete a Toll-Free Verification Submission
140+
describe 'delete_verification_request' do
141+
it 'deletes a toll free verification submission' do
142+
_data, status_code = @tfv_api_instance.delete_verification_request_with_http_info(BW_ACCOUNT_ID, tf_phone_number)
143+
expect(status_code).to eq(204)
144+
end
145+
end
146+
139147
# List Toll-Free Use Cases
140148
describe 'list_toll_free_use_cases test' do
141149
it 'lists toll free use cases' do

spec/unit/client/api_client_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@
268268
expect(api_client_default.convert_to_type({ id: 1 }, 'Object')).to eq({ id: 1 })
269269
expect(api_client_default.convert_to_type([[12, 34], [56]], 'Array<Array<Integer>>')).to eq([[12, 34], [56]])
270270
expect(api_client_default.convert_to_type({ "id": 'test' }, 'Hash<String, String>')).to eq({ id: 'test' })
271-
expect(api_client_default.convert_to_type({ set_or_expired: true }, 'DeferredResult')).to be_instance_of(Bandwidth::DeferredResult)
271+
expect(api_client_default.convert_to_type({ valid: true }, 'VerifyCodeResponse')).to be_instance_of(Bandwidth::VerifyCodeResponse)
272272
end
273273
end
274274

@@ -353,10 +353,10 @@
353353
end
354354

355355
it 'returns hash when object can be converted to hash' do
356-
model = Bandwidth::DeferredResult.new({
357-
set_or_expired: true
356+
model = Bandwidth::VerifyCodeResponse.new({
357+
valid: true
358358
})
359-
expected = { setOrExpired: true }
359+
expected = { valid: true }
360360
expect(api_client_default.object_to_hash(model)).to eq(expected)
361361
end
362362
end

spec/unit/models/deferred_result_spec.rb

Lines changed: 0 additions & 74 deletions
This file was deleted.

spec/unit/models/tfv_error_spec.rb

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Unit tests for Bandwidth::TfvError
2+
describe Bandwidth::TfvError do
3+
let(:tfv_error_default) { Bandwidth::TfvError.new }
4+
let(:tfv_error_values) { Bandwidth::TfvError.new({
5+
type: 'type',
6+
description: 'description',
7+
errors: { key: 'value' }
8+
}) }
9+
10+
describe '#initialize' do
11+
it 'causes an ArgumentError by passing an Array to the initialize method' do
12+
expect {
13+
Bandwidth::TfvError.new([])
14+
}.to raise_error(ArgumentError)
15+
end
16+
17+
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
18+
expect {
19+
Bandwidth::TfvError.new({ invalid: true })
20+
}.to raise_error(ArgumentError)
21+
end
22+
end
23+
24+
describe '#acceptable_attributes' do
25+
it 'expects acceptable JSON attributes to be those in the attribute map' do
26+
expect(Bandwidth::TfvError.acceptable_attributes).to eq(Bandwidth::TfvError.attribute_map.values)
27+
end
28+
end
29+
30+
describe 'enum validation' do
31+
it 'works' do
32+
33+
end
34+
end
35+
36+
describe '#build_from_hash' do
37+
it 'validates instance of TfvError created by the build_from_hash method' do
38+
tfv_error_from_hash = Bandwidth::TfvError.build_from_hash({
39+
type: 'type',
40+
description: 'description',
41+
errors: { key: 'value' }
42+
})
43+
expect(tfv_error_from_hash).to be_instance_of(Bandwidth::TfvError)
44+
expect(tfv_error_from_hash.type).to eq('type')
45+
expect(tfv_error_from_hash.description).to eq('description')
46+
expect(tfv_error_from_hash.errors).to eq({ key: 'value' })
47+
end
48+
end
49+
50+
describe '#hash' do
51+
it 'returns a hash code according to attributes' do
52+
expect(tfv_error_default.hash).to be_instance_of(Integer)
53+
end
54+
end
55+
56+
describe '#to_s' do
57+
it 'returns a string representation of the object' do
58+
expect(tfv_error_values.to_s).to eq('{:type=>"type", :description=>"description", :errors=>{:key=>"value"}}')
59+
end
60+
end
61+
62+
describe '#eq? #==' do
63+
it 'returns true/false when comparing objects' do
64+
expect(tfv_error_default.eql?(Bandwidth::TfvError.new)).to be true
65+
expect(tfv_error_default.eql?(tfv_error_values)).to be false
66+
end
67+
end
68+
69+
describe '#to_body #to_hash' do
70+
it 'returns a hash representation of the object' do
71+
expect(tfv_error_values.to_body).to eq({
72+
type: 'type',
73+
description: 'description',
74+
errors: { key: 'value' }
75+
})
76+
end
77+
end
78+
end
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Unit tests for Bandwidth::VerifyCodeResponse
2+
describe Bandwidth::VerifyCodeResponse do
3+
let(:verify_code_response_default) { Bandwidth::VerifyCodeResponse.new }
4+
let(:verify_code_response_values) { Bandwidth::VerifyCodeResponse.new({
5+
valid: true
6+
}) }
7+
8+
describe '#initialize' do
9+
it 'causes an ArgumentError by passing an Array to the initialize method' do
10+
expect {
11+
Bandwidth::VerifyCodeResponse.new([])
12+
}.to raise_error(ArgumentError)
13+
end
14+
15+
it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
16+
expect {
17+
Bandwidth::VerifyCodeResponse.new({ invalid: true })
18+
}.to raise_error(ArgumentError)
19+
end
20+
end
21+
22+
describe '#acceptable_attributes' do
23+
it 'expects acceptable JSON attributes to be those in the attribute map' do
24+
expect(Bandwidth::VerifyCodeResponse.acceptable_attributes).to eq(Bandwidth::VerifyCodeResponse.attribute_map.values)
25+
end
26+
end
27+
28+
describe '#openapi_nullable' do
29+
it 'expects nullable attributes to be an empty set' do
30+
expect(Bandwidth::VerifyCodeResponse.openapi_nullable).to eq(Set.new([]))
31+
end
32+
end
33+
34+
describe '#build_from_hash' do
35+
it 'validates instance of VerifyCodeResponse created by the build_from_hash method' do
36+
verify_code_response_from_hash = Bandwidth::VerifyCodeResponse.build_from_hash({
37+
valid: true
38+
})
39+
expect(verify_code_response_from_hash).to be_instance_of(Bandwidth::VerifyCodeResponse)
40+
expect(verify_code_response_from_hash.valid).to be true
41+
end
42+
end
43+
44+
describe '#hash' do
45+
it 'returns a hash code according to attributes' do
46+
expect(verify_code_response_default.hash).to be_instance_of(Integer)
47+
end
48+
end
49+
50+
describe '#to_s' do
51+
it 'returns a string representation of the object' do
52+
expect(verify_code_response_values.to_s).to eq('{:valid=>true}')
53+
end
54+
end
55+
56+
describe '#eq? #==' do
57+
it 'returns true/false when comparing objects' do
58+
expect(verify_code_response_default.eql?(Bandwidth::VerifyCodeResponse.new)).to be true
59+
expect(verify_code_response_default.eql?(verify_code_response_values)).to be false
60+
end
61+
end
62+
63+
describe '#to_body #to_hash' do
64+
it 'returns a hash representation of the object' do
65+
expect(verify_code_response_values.to_body).to eq({
66+
valid: true
67+
})
68+
end
69+
end
70+
end

0 commit comments

Comments
 (0)