Skip to content

Commit

Permalink
SWI-3663 Get Calls Test (#112)
Browse files Browse the repository at this point in the history
* SWI-3663 Get Calls Test

* revert to 40s sleep for GET call state
  • Loading branch information
ckoegel authored Oct 16, 2023
1 parent 96a0cec commit 55d43b4
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions spec/integration/calls_api_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,32 +89,26 @@
expect(status_code).to eq(200)
expect(data).to be_instance_of(Array)
expect(data[0]).to be_instance_of(Bandwidth::CallState)
expect(data[0].application_id).to eq(BW_VOICE_APPLICATION_ID)
expect(data[0].application_id.length).to eq(36)
expect(data[0].account_id).to eq(BW_ACCOUNT_ID)
end
end

# Get Call State Information
describe 'get_call_state' do
it 'gets the call state' do
begin
sleep(SLEEP_TIME_S)
data, status_code, headers = @calls_api_instance.get_call_state_with_http_info(BW_ACCOUNT_ID, $call_info_id)

expect(status_code).to eq(200)
expect(data).to be_instance_of(Bandwidth::CallState)
expect(data.call_id).to eq($call_info_id)
expect(data.account_id).to eq(BW_ACCOUNT_ID)
expect(data.application_id).to eq(BW_VOICE_APPLICATION_ID)
expect(data.start_time).to be_instance_of(Time).or be_nil
expect(data.last_update).to be_instance_of(Time)
expect(data.state).to be_instance_of(String)
expect(data.direction).to eq(direction)
rescue Bandwidth::ApiError => e
if e.code != 404
raise e
end
end
sleep(40) # wait 40s for voice API to update call status
data, status_code, headers = @calls_api_instance.get_call_state_with_http_info(BW_ACCOUNT_ID, $call_info_id)

expect(status_code).to eq(200)
expect(data).to be_instance_of(Bandwidth::CallState)
expect(data.call_id).to eq($call_info_id)
expect(data.account_id).to eq(BW_ACCOUNT_ID)
expect(data.application_id).to eq(BW_VOICE_APPLICATION_ID)
expect(data.start_time).to be_instance_of(Time).or be_nil
expect(data.last_update).to be_instance_of(Time)
expect(data.state).to be_instance_of(String)
expect(data.direction).to eq(direction)
end
end

Expand Down

0 comments on commit 55d43b4

Please sign in to comment.