From ac0987525815f318e7505b7c0bbde1f9a746444c Mon Sep 17 00:00:00 2001 From: PhilipWafula Date: Wed, 2 Jun 2021 12:21:42 +0300 Subject: [PATCH] Add account management integration tests. --- .../test_account_management.tavern.yaml | 365 ++++++++++++++++++ 1 file changed, 365 insertions(+) create mode 100644 apps/cic-ussd/tests/integration/test_account_management.tavern.yaml diff --git a/apps/cic-ussd/tests/integration/test_account_management.tavern.yaml b/apps/cic-ussd/tests/integration/test_account_management.tavern.yaml new file mode 100644 index 00000000..870c26c6 --- /dev/null +++ b/apps/cic-ussd/tests/integration/test_account_management.tavern.yaml @@ -0,0 +1,365 @@ +test_name: Test performing account management operations. +marks: + - usefixtures: + - server_url + - token_symbol + - first_account_pin_number + - second_account_pin_number + - first_account_phone_number + - second_account_phone_number + - first_account_management_session_id + - second_account_management_session_id + - first_account_management_session_id_1 + - second_account_management_session_id_1 + - fourth + +stages: + - name: Account management start menu [first account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{first_account_management_session_id}" + phoneNumber: "{first_account_phone_number}" + text: "" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '51' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON Balance 58.00 {token_symbol}\n1. Send\n2. My Account\n3. Help" + + - name: Account management start menu [second account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{second_account_management_session_id}" + phoneNumber: "{second_account_phone_number}" + text: "" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '56' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON Salio 42.00 {token_symbol}\n1. Tuma\n2. Akaunti yangu\n3. Usaidizi" + + - name: Account management menu [first account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{first_account_management_session_id}" + phoneNumber: "{first_account_phone_number}" + text: "2" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '105' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON My account\n1. My profile\n2. Change language\n3. Check balance\n4. Check statement\n5. Change PIN\n0. Back" + + - name: Account management menu [second account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{second_account_management_session_id}" + phoneNumber: "{second_account_phone_number}" + text: "2" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '148' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON Akaunti yangu\n1. Wasifu wangu\n2. Chagua lugha utakayotumia\n3. Angalia salio\n4. Angalia taarifa ya matumizi\n5. Badilisha nambari ya siri\n0. Nyuma" + + - name: Language change [first account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{first_account_management_session_id}" + phoneNumber: "{first_account_phone_number}" + text: "2*2" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '51' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON Choose language\n1. English\n2. Kiswahili\n0. Back" + + - name: Language change [second account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{second_account_management_session_id}" + phoneNumber: "{second_account_phone_number}" + text: "2*2" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '51' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON Chagua lugha\n1. Kingereza\n2. Kiswahili\n0. Nyuma" + + - name: Select language [first account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{first_account_management_session_id}" + phoneNumber: "{first_account_phone_number}" + text: "2*2*2" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '30' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "END Asante kwa kutumia huduma." + + - name: Select language [second account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{second_account_management_session_id}" + phoneNumber: "{second_account_phone_number}" + text: "2*2*1" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '36' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "END Thank you for using the service." + + - name: Second account management start menu [first account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{first_account_management_session_id_1}" + phoneNumber: "{first_account_phone_number}" + text: "" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '56' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON Salio 58.00 {token_symbol}\n1. Tuma\n2. Akaunti yangu\n3. Usaidizi" + + - name: Second account management start menu [second account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{second_account_management_session_id_1}" + phoneNumber: "{second_account_phone_number}" + text: "" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '51' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON Balance 42.00 {token_symbol}\n1. Send\n2. My Account\n3. Help" + + - name: Second account management menu [first account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{first_account_management_session_id_1}" + phoneNumber: "{first_account_phone_number}" + text: "2" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '148' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON Akaunti yangu\n1. Wasifu wangu\n2. Chagua lugha utakayotumia\n3. Angalia salio\n4. Angalia taarifa ya matumizi\n5. Badilisha nambari ya siri\n0. Nyuma" + + - name: Second account management menu [second account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{second_account_management_session_id_1}" + phoneNumber: "{second_account_phone_number}" + text: "2" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '105' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON My account\n1. My profile\n2. Change language\n3. Check balance\n4. Check statement\n5. Change PIN\n0. Back" + + - name: Check balance [first account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{first_account_management_session_id_1}" + phoneNumber: "{first_account_phone_number}" + text: "2*3" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '49' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON Tafadhali weka PIN yako kuona salio.\n0. Nyuma" + + - name: Check balance [second account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{second_account_management_session_id_1}" + phoneNumber: "{second_account_phone_number}" + text: "2*3" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '50' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON Please enter your PIN to view balances\n0. Back" + + - name: Display balances [first account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{first_account_management_session_id_1}" + phoneNumber: "{first_account_phone_number}" + text: "2*3*{first_account_pin_number}" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON Salio zako ni zifuatazo:\n salio: 58.00 {token_symbol}\n ushuru: {token_symbol}\n tuzo: {token_symbol}\n0. Nyuma" + + - name: Display balances [second account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{second_account_management_session_id_1}" + phoneNumber: "{second_account_phone_number}" + text: "2*3*{second_account_pin_number}" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON Your balances are as follows:\n balance: 42.00 {token_symbol}\n fees: {token_symbol}\n rewards: {token_symbol}\n0. Back" \ No newline at end of file