Sha256: 046d2311168ac0bb7c525b1892064895ba01d81bc9b2741bc3d18de833a0499a
Contents?: true
Size: 1.65 KB
Versions: 9
Compression:
Stored size: 1.65 KB
Contents
# Integration Tests for Bandwidth::StatisticsApi describe 'StatisticsApi Integration Tests' do before(:all) do WebMock.allow_net_connect! Bandwidth.configure do |config| config.username = BW_USERNAME config.password = BW_PASSWORD end @statistics_api_instance = Bandwidth::StatisticsApi.new end after(:all) do WebMock.disable_net_connect! end # Get Account Statistics describe 'get_statistics' do it 'gets account statistics' do data, status_code, headers = @statistics_api_instance.get_statistics_with_http_info(BW_ACCOUNT_ID) expect(status_code).to eq(200) expect(data).to be_instance_of(Bandwidth::AccountStatistics) expect(data.current_call_queue_size).to be_instance_of(Integer) expect(data.max_call_queue_size).to eq(7500) end end # HTTP 4XX Errors describe 'http error' do it 'causes a 401 error' do Bandwidth.configure do |config| config.username = UNAUTHORIZED_USERNAME config.password = UNAUTHORIZED_PASSWORD end expect { @statistics_api_instance.get_statistics_with_http_info(BW_ACCOUNT_ID) }.to raise_error { |e| expect(e).to be_instance_of(Bandwidth::ApiError) expect(e.code).to eq(401) } end it 'causes a 403 error' do Bandwidth.configure do |config| config.username = FORBIDDEN_USERNAME config.password = FORBIDDEN_PASSWORD end expect { @statistics_api_instance.get_statistics_with_http_info(BW_ACCOUNT_ID) }.to raise_error { |e| expect(e).to be_instance_of(Bandwidth::ApiError) expect(e.code).to eq(403) } end end end
Version data entries
9 entries across 9 versions & 1 rubygems