Skip to content

Commit 49eb70d

Browse files
authored
DX-2165 Update integration test env variables (#28)
* Update integration test env variables * Replace remaining MFA env variables * Update workflows * Update expected BXML * Missed an expected BXML response * Accidental BXML gather parameter changes
1 parent b6d6ecf commit 49eb70d

File tree

3 files changed

+77
-74
lines changed

3 files changed

+77
-74
lines changed

.github/workflows/deploy.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,21 @@ jobs:
1616
- name: Validate
1717
uses: ./.github/actions/validate
1818
env:
19-
USERNAME: ${{ secrets.USERNAME }}
20-
PASSWORD: ${{ secrets.PASSWORD }}
21-
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
22-
VOICE_APPLICATION_ID: ${{ secrets.VOICE_APPLICATION_ID }}
23-
MESSAGING_APPLICATION_ID: ${{ secrets.MESSAGING_APPLICATION_ID }}
24-
CALLBACK_URL: ${{ secrets.CALLBACK_URL }}
25-
PHONE_NUMBER_OUTBOUND: ${{ secrets.PHONE_NUMBER_OUTBOUND }}
26-
PHONE_NUMBER_INBOUND: ${{ secrets.PHONE_NUMBER_INBOUND }}
27-
MFA_MESSAGING_APPLICATION_ID: ${{ secrets.MFA_MESSAGING_APPLICATION_ID }}
28-
MFA_VOICE_APPLICATION_ID: ${{ secrets.MFA_VOICE_APPLICATION_ID }}
29-
PHONE_NUMBER_MFA: ${{ secrets.PHONE_NUMBER_MFA }}
19+
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
20+
BW_USERNAME: ${{ secrets.BW_USERNAME }}
21+
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
22+
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
23+
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
24+
BW_NUMBER: ${{ secrets.BW_NUMBER }}
25+
USER_NUMBER: ${{ secrets.USER_NUMBER }}
26+
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
3027
- name: Deploy to Rubygems
3128
uses: ./.github/actions/deploy
3229
env:
3330
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
31+
- uses: Bandwidth/[email protected]
32+
if: always()
33+
with:
34+
job-status: ${{ job.status }}
35+
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
36+
slack-channel: ${{ secrets.SLACK_CHANNEL }}

.github/workflows/validate.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,17 @@ jobs:
1515
- name: Validate
1616
uses: ./.github/actions/validate
1717
env:
18-
USERNAME: ${{ secrets.USERNAME }}
19-
PASSWORD: ${{ secrets.PASSWORD }}
20-
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
21-
VOICE_APPLICATION_ID: ${{ secrets.VOICE_APPLICATION_ID }}
22-
MESSAGING_APPLICATION_ID: ${{ secrets.MESSAGING_APPLICATION_ID }}
23-
CALLBACK_URL: ${{ secrets.CALLBACK_URL }}
24-
PHONE_NUMBER_OUTBOUND: ${{ secrets.PHONE_NUMBER_OUTBOUND }}
25-
PHONE_NUMBER_INBOUND: ${{ secrets.PHONE_NUMBER_INBOUND }}
26-
MFA_MESSAGING_APPLICATION_ID: ${{ secrets.MFA_MESSAGING_APPLICATION_ID }}
27-
MFA_VOICE_APPLICATION_ID: ${{ secrets.MFA_VOICE_APPLICATION_ID }}
28-
PHONE_NUMBER_MFA: ${{ secrets.PHONE_NUMBER_MFA }}
18+
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
19+
BW_USERNAME: ${{ secrets.BW_USERNAME }}
20+
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
21+
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
22+
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
23+
BW_NUMBER: ${{ secrets.BW_NUMBER }}
24+
USER_NUMBER: ${{ secrets.USER_NUMBER }}
25+
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
26+
- uses: Bandwidth/[email protected]
27+
if: always()
28+
with:
29+
job-status: ${{ job.status }}
30+
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
31+
slack-channel: ${{ secrets.SLACK_CHANNEL }}

test/integration/test_integration.rb

Lines changed: 49 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,14 @@
1212
include Bandwidth::WebRtc
1313

1414
begin
15-
USERNAME = ENV.fetch("USERNAME")
16-
PASSWORD = ENV.fetch("PASSWORD")
17-
ACCOUNT_ID = ENV.fetch("ACCOUNT_ID")
18-
VOICE_APPLICATION_ID = ENV.fetch("VOICE_APPLICATION_ID")
19-
MESSAGING_APPLICATION_ID = ENV.fetch("MESSAGING_APPLICATION_ID")
20-
CALLBACK_URL = ENV.fetch("CALLBACK_URL")
21-
PHONE_NUMBER_OUTBOUND = ENV.fetch("PHONE_NUMBER_OUTBOUND")
22-
PHONE_NUMBER_INBOUND = ENV.fetch("PHONE_NUMBER_INBOUND")
23-
MFA_MESSAGING_APPLICATION_ID = ENV.fetch("MFA_MESSAGING_APPLICATION_ID")
24-
MFA_VOICE_APPLICATION_ID = ENV.fetch("MFA_VOICE_APPLICATION_ID")
25-
PHONE_NUMBER_MFA = ENV.fetch("PHONE_NUMBER_MFA")
15+
BW_USERNAME = ENV.fetch("BW_USERNAME")
16+
BW_PASSWORD = ENV.fetch("BW_PASSWORD")
17+
BW_ACCOUNT_ID = ENV.fetch("BW_ACCOUNT_ID")
18+
BW_VOICE_APPLICATION_ID = ENV.fetch("BW_VOICE_APPLICATION_ID")
19+
BW_MESSAGING_APPLICATION_ID = ENV.fetch("BW_MESSAGING_APPLICATION_ID")
20+
BASE_CALLBACK_URL = ENV.fetch("BASE_CALLBACK_URL")
21+
BW_NUMBER = ENV.fetch("BW_NUMBER")
22+
USER_NUMBER = ENV.fetch("USER_NUMBER")
2623
rescue
2724
puts "Environmental variables not found"
2825
exit(-1)
@@ -31,35 +28,35 @@
3128
class IntegrationTest < Test::Unit::TestCase
3229
def setup
3330
@bandwidth_client = Bandwidth::Client.new(
34-
voice_basic_auth_user_name: USERNAME,
35-
voice_basic_auth_password: PASSWORD,
36-
messaging_basic_auth_user_name: USERNAME,
37-
messaging_basic_auth_password: PASSWORD,
38-
multi_factor_auth_basic_auth_user_name: USERNAME,
39-
multi_factor_auth_basic_auth_password: PASSWORD,
40-
phone_number_lookup_basic_auth_user_name: USERNAME,
41-
phone_number_lookup_basic_auth_password: PASSWORD
31+
voice_basic_auth_user_name: BW_USERNAME,
32+
voice_basic_auth_password: BW_PASSWORD,
33+
messaging_basic_auth_user_name: BW_USERNAME,
34+
messaging_basic_auth_password: BW_PASSWORD,
35+
multi_factor_auth_basic_auth_user_name: BW_USERNAME,
36+
multi_factor_auth_basic_auth_password: BW_PASSWORD,
37+
phone_number_lookup_basic_auth_user_name: BW_USERNAME,
38+
phone_number_lookup_basic_auth_password: BW_PASSWORD
4239
)
4340
end
4441

4542
def test_create_message
4643
body = MessageRequest.new
47-
body.application_id = MESSAGING_APPLICATION_ID
48-
body.to = [PHONE_NUMBER_INBOUND]
49-
body.from = PHONE_NUMBER_OUTBOUND
44+
body.application_id = BW_MESSAGING_APPLICATION_ID
45+
body.to = [USER_NUMBER]
46+
body.from = BW_NUMBER
5047
body.text = "Ruby Integration"
51-
response = @bandwidth_client.messaging_client.client.create_message(ACCOUNT_ID, body)
48+
response = @bandwidth_client.messaging_client.client.create_message(BW_ACCOUNT_ID, body)
5249
assert(response.data.id.length > 0, "id value not set") #validate that _some_ id was returned
5350
end
5451

5552
def test_create_message_invalid_phone_number
5653
body = MessageRequest.new
57-
body.application_id = MESSAGING_APPLICATION_ID
54+
body.application_id = BW_MESSAGING_APPLICATION_ID
5855
body.to = ["+1invalid"]
59-
body.from = PHONE_NUMBER_OUTBOUND
56+
body.from = BW_NUMBER
6057
body.text = "Ruby Integration"
6158
begin
62-
@bandwidth_client.messaging_client.client.create_message(ACCOUNT_ID, body)
59+
@bandwidth_client.messaging_client.client.create_message(BW_ACCOUNT_ID, body)
6360
#workaround to make sure that if the above error is not raised, the build will fail
6461
assert(false, "Expected exception not raised")
6562
rescue MessagingException => e
@@ -73,37 +70,37 @@ def test_upload_download_media
7370
media_file = '12345' #todo: check a binary string
7471

7572
#media upload
76-
@bandwidth_client.messaging_client.client.upload_media(ACCOUNT_ID, media_file_name, media_file, :content_type => "application/octet-stream", :cache_control => "no-cache")
73+
@bandwidth_client.messaging_client.client.upload_media(BW_ACCOUNT_ID, media_file_name, media_file, :content_type => "application/octet-stream", :cache_control => "no-cache")
7774

7875
#media download
79-
downloaded_media_file = @bandwidth_client.messaging_client.client.get_media(ACCOUNT_ID, media_file_name).data
76+
downloaded_media_file = @bandwidth_client.messaging_client.client.get_media(BW_ACCOUNT_ID, media_file_name).data
8077

8178
assert_equal(downloaded_media_file, media_file, "Downloaded media file not equal to upload")
8279
end
8380

8481
def test_create_call_and_get_call_state
8582
body = CreateCallRequest.new
86-
body.from = PHONE_NUMBER_OUTBOUND
87-
body.to = PHONE_NUMBER_INBOUND
88-
body.application_id = VOICE_APPLICATION_ID
89-
body.answer_url = CALLBACK_URL
90-
response = @bandwidth_client.voice_client.client.create_call(ACCOUNT_ID, body)
83+
body.from = BW_NUMBER
84+
body.to = USER_NUMBER
85+
body.application_id = BW_VOICE_APPLICATION_ID
86+
body.answer_url = BASE_CALLBACK_URL
87+
response = @bandwidth_client.voice_client.client.create_call(BW_ACCOUNT_ID, body)
9188
assert(response.data.call_id.length > 0, "call_id value not set")
9289

9390
#Get phone call information
94-
response = @bandwidth_client.voice_client.client.get_call(ACCOUNT_ID, response.data.call_id)
91+
response = @bandwidth_client.voice_client.client.get_call(BW_ACCOUNT_ID, response.data.call_id)
9592
assert(response.data.state.length > 0, "state value not set")
9693
end
9794

9895
def test_create_call_invalid_phone_number
9996
body = CreateCallRequest.new
100-
body.from = PHONE_NUMBER_OUTBOUND
97+
body.from = BW_NUMBER
10198
body.to = "+1invalid"
102-
body.application_id = VOICE_APPLICATION_ID
103-
body.answer_url = CALLBACK_URL
99+
body.application_id = BW_VOICE_APPLICATION_ID
100+
body.answer_url = BASE_CALLBACK_URL
104101

105102
begin
106-
@bandwidth_client.voice_client.client.create_call(ACCOUNT_ID, :body => body)
103+
@bandwidth_client.voice_client.client.create_call(BW_ACCOUNT_ID, :body => body)
107104
#workaround to make sure that if the above error is not raised, the build will fail
108105
assert(false, "Expected exception not raised")
109106
rescue ApiErrorException => e
@@ -467,38 +464,38 @@ def test_conference_no_coach
467464

468465
def test_mfa_messaging
469466
body = TwoFactorCodeRequestSchema.new
470-
body.from = PHONE_NUMBER_MFA
471-
body.to = PHONE_NUMBER_INBOUND
472-
body.application_id = MFA_MESSAGING_APPLICATION_ID
467+
body.from = BW_NUMBER
468+
body.to = USER_NUMBER
469+
body.application_id = BW_MESSAGING_APPLICATION_ID
473470
body.scope = "scope"
474471
body.digits = 6
475472
body.message = "Your temporary {NAME} {SCOPE} code is {CODE}"
476473

477-
response = @bandwidth_client.multi_factor_auth_client.mfa.create_messaging_two_factor(ACCOUNT_ID, body)
474+
response = @bandwidth_client.multi_factor_auth_client.mfa.create_messaging_two_factor(BW_ACCOUNT_ID, body)
478475
assert(response.data.message_id.length > 0, "message id value not set")
479476
end
480477

481478
def test_mfa_voice
482479
body = TwoFactorCodeRequestSchema.new
483-
body.from = PHONE_NUMBER_MFA
484-
body.to = PHONE_NUMBER_INBOUND
485-
body.application_id = MFA_VOICE_APPLICATION_ID
480+
body.from = BW_NUMBER
481+
body.to = USER_NUMBER
482+
body.application_id = BW_VOICE_APPLICATION_ID
486483
body.scope = "scope"
487484
body.digits = 6
488485
body.message = "Your temporary {NAME} {SCOPE} code is {CODE}"
489486

490-
response = @bandwidth_client.multi_factor_auth_client.mfa.create_voice_two_factor(ACCOUNT_ID, body)
487+
response = @bandwidth_client.multi_factor_auth_client.mfa.create_voice_two_factor(BW_ACCOUNT_ID, body)
491488
assert(response.data.call_id.length > 0, "call id value not set")
492489
end
493490

494491
def test_mfa_verify
495492
body = TwoFactorVerifyRequestSchema.new
496-
body.to = PHONE_NUMBER_INBOUND
497-
body.application_id = MFA_VOICE_APPLICATION_ID
493+
body.to = USER_NUMBER
494+
body.application_id = BW_VOICE_APPLICATION_ID
498495
body.scope = "scope"
499496
body.code = "123456"
500497
body.expiration_time_in_minutes = 3
501-
response = @bandwidth_client.multi_factor_auth_client.mfa.create_verify_two_factor(ACCOUNT_ID, body)
498+
response = @bandwidth_client.multi_factor_auth_client.mfa.create_verify_two_factor(BW_ACCOUNT_ID, body)
502499
#Ruby has no check to see if variables are of type boolean
503500
#An explicit true/false check is required
504501
assert(response.data.valid == true || response.data.valid == false, "'valid' variable is not a boolean")
@@ -573,12 +570,12 @@ def test_stop_gather
573570

574571
def test_tn_lookup
575572
body = OrderRequest.new
576-
body.tns = [PHONE_NUMBER_OUTBOUND]
577-
create_response = @bandwidth_client.phone_number_lookup_client.client.create_lookup_request(ACCOUNT_ID, body)
573+
body.tns = [BW_NUMBER]
574+
create_response = @bandwidth_client.phone_number_lookup_client.client.create_lookup_request(BW_ACCOUNT_ID, body)
578575
assert(create_response.data.request_id.length > 0, "request_id value not set")
579576

580577
request_id = create_response.data.request_id
581-
get_response = @bandwidth_client.phone_number_lookup_client.client.get_lookup_request_status(ACCOUNT_ID, request_id)
578+
get_response = @bandwidth_client.phone_number_lookup_client.client.get_lookup_request_status(BW_ACCOUNT_ID, request_id)
582579
assert(get_response.data.status.length > 0, "status value not set")
583580
end
584581

0 commit comments

Comments
 (0)