|
1 | | -=begin |
2 | | -#Bandwidth |
3 | | -
|
4 | | -#Bandwidth's Communication APIs |
5 | | -
|
6 | | -The version of the OpenAPI document: 1.0.0 |
7 | | -Contact: letstalk@bandwidth.com |
8 | | -Generated by: https://openapi-generator.tech |
9 | | -Generator version: 7.17.0 |
10 | | -
|
11 | | -=end |
12 | | - |
13 | | -require 'spec_helper' |
14 | | -require 'json' |
15 | | -require 'date' |
16 | | - |
17 | 1 | # Unit tests for Bandwidth::BridgeCompleteCallback |
18 | | -# Automatically generated by openapi-generator (https://openapi-generator.tech) |
19 | | -# Please update as you see appropriate |
20 | 2 | describe Bandwidth::BridgeCompleteCallback do |
21 | | - # let(:instance) { Bandwidth::BridgeCompleteCallback.new } |
22 | | - |
23 | | - describe 'test an instance of BridgeCompleteCallback' do |
24 | | - it 'should create an instance of BridgeCompleteCallback' do |
25 | | - # uncomment below to test the instance creation |
26 | | - # expect(instance).to be_instance_of(Bandwidth::BridgeCompleteCallback) |
27 | | - end |
28 | | - end |
29 | | - |
30 | | - describe 'test attribute "event_type"' do |
31 | | - it 'should work' do |
32 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
33 | | - end |
34 | | - end |
35 | | - |
36 | | - describe 'test attribute "event_time"' do |
37 | | - it 'should work' do |
38 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
39 | | - end |
40 | | - end |
41 | | - |
42 | | - describe 'test attribute "account_id"' do |
43 | | - it 'should work' do |
44 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
45 | | - end |
46 | | - end |
47 | | - |
48 | | - describe 'test attribute "application_id"' do |
49 | | - it 'should work' do |
50 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
51 | | - end |
52 | | - end |
53 | | - |
54 | | - describe 'test attribute "from"' do |
55 | | - it 'should work' do |
56 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
57 | | - end |
58 | | - end |
59 | | - |
60 | | - describe 'test attribute "to"' do |
61 | | - it 'should work' do |
62 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
63 | | - end |
64 | | - end |
65 | | - |
66 | | - describe 'test attribute "direction"' do |
67 | | - it 'should work' do |
68 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
69 | | - end |
70 | | - end |
71 | | - |
72 | | - describe 'test attribute "call_id"' do |
73 | | - it 'should work' do |
74 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
75 | | - end |
76 | | - end |
77 | | - |
78 | | - describe 'test attribute "call_url"' do |
79 | | - it 'should work' do |
80 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
81 | | - end |
82 | | - end |
83 | | - |
84 | | - describe 'test attribute "enqueued_time"' do |
85 | | - it 'should work' do |
86 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
87 | | - end |
88 | | - end |
89 | | - |
90 | | - describe 'test attribute "start_time"' do |
91 | | - it 'should work' do |
92 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
93 | | - end |
94 | | - end |
95 | | - |
96 | | - describe 'test attribute "answer_time"' do |
97 | | - it 'should work' do |
98 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
99 | | - end |
100 | | - end |
101 | | - |
102 | | - describe 'test attribute "tag"' do |
103 | | - it 'should work' do |
104 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
105 | | - end |
106 | | - end |
107 | | - |
108 | | - describe 'test attribute "cause"' do |
109 | | - it 'should work' do |
110 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
111 | | - end |
112 | | - end |
113 | | - |
114 | | - describe 'test attribute "error_message"' do |
115 | | - it 'should work' do |
116 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
117 | | - end |
118 | | - end |
119 | | - |
120 | | - describe 'test attribute "error_id"' do |
121 | | - it 'should work' do |
122 | | - # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ |
| 3 | + let(:bridge_complete_callback_default) { Bandwidth::BridgeCompleteCallback.new } |
| 4 | + let(:bridge_complete_callback_values) { Bandwidth::BridgeCompleteCallback.new({ |
| 5 | + event_type: 'bridgeComplete', |
| 6 | + event_time: '2022-06-16T13:15:07.160Z', |
| 7 | + account_id: '9900000', |
| 8 | + application_id: '04e88489-df02-4e34-a0ee-27a91849555f', |
| 9 | + from: '+19195554321', |
| 10 | + to: '+19195551234', |
| 11 | + direction: Bandwidth::CallDirectionEnum::OUTBOUND, |
| 12 | + call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85', |
| 13 | + call_url: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85', |
| 14 | + enqueued_time: '2022-06-16T13:15:07.160Z', |
| 15 | + start_time: '2022-06-16T13:15:07.160Z', |
| 16 | + answer_time: '2022-06-16T13:15:18.126Z', |
| 17 | + tag: 'custom tag', |
| 18 | + cause: 'hangup', |
| 19 | + error_message: 'call rejected', |
| 20 | + error_id: '4642074b-7b58-478b-96e4-3a60955c6765' |
| 21 | + }) } |
| 22 | + |
| 23 | + describe '#initialize' do |
| 24 | + it 'causes an ArgumentError by passing an Array to the initialize method' do |
| 25 | + expect { |
| 26 | + Bandwidth::BridgeCompleteCallback.new([]) |
| 27 | + }.to raise_error(ArgumentError) |
| 28 | + end |
| 29 | + |
| 30 | + it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do |
| 31 | + expect { |
| 32 | + Bandwidth::BridgeCompleteCallback.new({ invalid: true }) |
| 33 | + }.to raise_error(ArgumentError) |
| 34 | + end |
| 35 | + end |
| 36 | + |
| 37 | + describe '#acceptable_attributes' do |
| 38 | + it 'expects acceptable JSON attributes to be those in the attribute map' do |
| 39 | + expect(Bandwidth::BridgeCompleteCallback.acceptable_attributes).to eq(Bandwidth::BridgeCompleteCallback.attribute_map.values) |
| 40 | + end |
| 41 | + end |
| 42 | + |
| 43 | + describe '#openapi_nullable' do |
| 44 | + it 'expects nullable attributes to be the set of nullable fields' do |
| 45 | + expect(Bandwidth::BridgeCompleteCallback.openapi_nullable).to eq(Set.new([ |
| 46 | + :'enqueued_time', |
| 47 | + :'answer_time', |
| 48 | + :'tag', |
| 49 | + :'error_message', |
| 50 | + :'error_id' |
| 51 | + ])) |
| 52 | + end |
| 53 | + end |
| 54 | + |
| 55 | + describe '#build_from_hash' do |
| 56 | + it 'validates instance of BridgeCompleteCallback created by the build_from_hash method' do |
| 57 | + bridge_complete_callback_from_hash = Bandwidth::BridgeCompleteCallback.build_from_hash({ |
| 58 | + eventType: 'bridgeComplete', |
| 59 | + eventTime: '2022-06-16T13:15:07.160Z', |
| 60 | + accountId: '9900000', |
| 61 | + applicationId: '04e88489-df02-4e34-a0ee-27a91849555f', |
| 62 | + from: '+19195554321', |
| 63 | + to: '+19195551234', |
| 64 | + direction: Bandwidth::CallDirectionEnum::OUTBOUND, |
| 65 | + callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85', |
| 66 | + callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85', |
| 67 | + enqueuedTime: '2022-06-16T13:15:07.160Z', |
| 68 | + startTime: '2022-06-16T13:15:07.160Z', |
| 69 | + answerTime: '2022-06-16T13:15:18.126Z', |
| 70 | + tag: 'custom tag', |
| 71 | + cause: 'hangup', |
| 72 | + errorMessage: 'call rejected', |
| 73 | + errorId: '4642074b-7b58-478b-96e4-3a60955c6765' |
| 74 | + }) |
| 75 | + expect(bridge_complete_callback_from_hash).to be_instance_of(Bandwidth::BridgeCompleteCallback) |
| 76 | + expect(bridge_complete_callback_from_hash.event_type).to eq('bridgeComplete') |
| 77 | + expect(bridge_complete_callback_from_hash.event_time).to eq(Time.parse('2022-06-16T13:15:07.160Z')) |
| 78 | + expect(bridge_complete_callback_from_hash.account_id).to eq('9900000') |
| 79 | + expect(bridge_complete_callback_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f') |
| 80 | + expect(bridge_complete_callback_from_hash.from).to eq('+19195554321') |
| 81 | + expect(bridge_complete_callback_from_hash.to).to eq('+19195551234') |
| 82 | + expect(bridge_complete_callback_from_hash.direction).to eq(Bandwidth::CallDirectionEnum::OUTBOUND) |
| 83 | + expect(bridge_complete_callback_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85') |
| 84 | + expect(bridge_complete_callback_from_hash.call_url).to eq('https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85') |
| 85 | + expect(bridge_complete_callback_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z')) |
| 86 | + expect(bridge_complete_callback_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z')) |
| 87 | + expect(bridge_complete_callback_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z')) |
| 88 | + expect(bridge_complete_callback_from_hash.tag).to eq('custom tag') |
| 89 | + expect(bridge_complete_callback_from_hash.cause).to eq('hangup') |
| 90 | + expect(bridge_complete_callback_from_hash.error_message).to eq('call rejected') |
| 91 | + expect(bridge_complete_callback_from_hash.error_id).to eq('4642074b-7b58-478b-96e4-3a60955c6765') |
| 92 | + end |
| 93 | + end |
| 94 | + |
| 95 | + describe '#to_s' do |
| 96 | + it 'returns a string representation of the object' do |
| 97 | + expect(bridge_complete_callback_values.to_s).to eq('{:eventType=>"bridgeComplete", :eventTime=>"2022-06-16T13:15:07.160Z", :accountId=>"9900000", :applicationId=>"04e88489-df02-4e34-a0ee-27a91849555f", :from=>"+19195554321", :to=>"+19195551234", :direction=>"outbound", :callId=>"c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :callUrl=>"https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85", :enqueuedTime=>"2022-06-16T13:15:07.160Z", :startTime=>"2022-06-16T13:15:07.160Z", :answerTime=>"2022-06-16T13:15:18.126Z", :tag=>"custom tag", :cause=>"hangup", :errorMessage=>"call rejected", :errorId=>"4642074b-7b58-478b-96e4-3a60955c6765"}') |
| 98 | + end |
| 99 | + end |
| 100 | + |
| 101 | + describe '#eq? #==' do |
| 102 | + it 'returns true/false when comparing objects' do |
| 103 | + expect(bridge_complete_callback_default.eql?(Bandwidth::BridgeCompleteCallback.new)).to be true |
| 104 | + expect(bridge_complete_callback_default.eql?(bridge_complete_callback_values)).to be false |
| 105 | + end |
| 106 | + end |
| 107 | + |
| 108 | + describe '#to_body #to_hash' do |
| 109 | + it 'returns a hash representation of the object' do |
| 110 | + expect(bridge_complete_callback_values.to_body).to eq({ |
| 111 | + eventType: 'bridgeComplete', |
| 112 | + eventTime: '2022-06-16T13:15:07.160Z', |
| 113 | + accountId: '9900000', |
| 114 | + applicationId: '04e88489-df02-4e34-a0ee-27a91849555f', |
| 115 | + from: '+19195554321', |
| 116 | + to: '+19195551234', |
| 117 | + direction: Bandwidth::CallDirectionEnum::OUTBOUND, |
| 118 | + callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85', |
| 119 | + callUrl: 'https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85', |
| 120 | + enqueuedTime: '2022-06-16T13:15:07.160Z', |
| 121 | + startTime: '2022-06-16T13:15:07.160Z', |
| 122 | + answerTime: '2022-06-16T13:15:18.126Z', |
| 123 | + tag: 'custom tag', |
| 124 | + cause: 'hangup', |
| 125 | + errorMessage: 'call rejected', |
| 126 | + errorId: '4642074b-7b58-478b-96e4-3a60955c6765' |
| 127 | + }) |
123 | 128 | end |
124 | 129 | end |
125 | 130 | end |
0 commit comments