From c0f578db7598e8bae3763d33b87aadd6e70b1870 Mon Sep 17 00:00:00 2001 From: PhilipWafula Date: Mon, 17 May 2021 16:00:19 +0300 Subject: [PATCH] Adds transaction tests. --- .../integration/test_accounts.tavern.yaml | 200 +++++++++++++++++- 1 file changed, 190 insertions(+), 10 deletions(-) diff --git a/apps/cic-ussd/tests/integration/test_accounts.tavern.yaml b/apps/cic-ussd/tests/integration/test_accounts.tavern.yaml index efcf2d25..9d78ecf0 100644 --- a/apps/cic-ussd/tests/integration/test_accounts.tavern.yaml +++ b/apps/cic-ussd/tests/integration/test_accounts.tavern.yaml @@ -7,6 +7,12 @@ marks: - generate_session_id - first_account_phone_number - second_account_phone_number + - first_account_family_name + - second_account_family_name + - first_account_given_name + - second_account_given_name + - first_transaction_session_id + - second_transaction_session_id - first_metadata_entry_session_id - second_metadata_entry_session_id stages: @@ -231,14 +237,14 @@ stages: extra_kwargs: expected_response: "CON Weka jina lako la kwanza\n0. Nyuma" - - name: Enter first name [Kimani - first account] + - name: Enter first name [first_account_given_name - first account] request: url: "{server_url}" data: serviceCode: "*483*46#" sessionId: "{first_metadata_entry_session_id}" phoneNumber: "{first_account_phone_number}" - text: "1*0000*0000*Kimani" + text: "1*0000*0000*{first_account_given_name}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -253,14 +259,14 @@ stages: extra_kwargs: expected_response: "CON Enter last name\n0. Back" - - name: Enter first name [Chebet - second account] + - name: Enter first name [second_account_given_name - second account] request: url: "{server_url}" data: serviceCode: "*483*46#" sessionId: "{second_metadata_entry_session_id}" phoneNumber: "{second_account_phone_number}" - text: "2*1212*1212*Chebet" + text: "2*1212*1212*{second_account_given_name}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -275,14 +281,14 @@ stages: extra_kwargs: expected_response: "CON Weka jina lako la mwisho\n0. Nyuma" - - name: Enter last name [Omollo - first account] + - name: Enter last name [first_account_family_name - first account] request: url: "{server_url}" data: serviceCode: "*483*46#" sessionId: "{first_metadata_entry_session_id}" phoneNumber: "{first_account_phone_number}" - text: "1*0000*0000*Kimani*Omollo" + text: "1*0000*0000*{first_account_given_name}*{first_account_family_name}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -297,14 +303,14 @@ stages: extra_kwargs: expected_response: "CON Enter gender\n1. Male\n2. Female\n0. Back" - - name: Enter last name [Musau - second account] + - name: Enter last name [second_account_family_name - second account] request: url: "{server_url}" data: serviceCode: "*483*46#" sessionId: "{second_metadata_entry_session_id}" phoneNumber: "{second_account_phone_number}" - text: "2*1212*1212*Chebet*Musau" + text: "2*1212*1212*{second_account_given_name}*{second_account_family_name}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -428,7 +434,7 @@ stages: function: ext.validator:validate_response extra_kwargs: expected_response: "CON Balance {gift_value} {token_symbol}\n1. Send\n2. My Account\n3. Help" - delay_before: 5 + delay_before: 10 - name: Enter product [Mkalimani - second account] request: @@ -451,4 +457,178 @@ stages: function: ext.validator:validate_response extra_kwargs: expected_response: "CON Salio {gift_value} {token_symbol}\n1. Tuma\n2. Akaunti yangu\n3. Usaidizi" - delay_before: 5 + delay_before: 10 + + - name: Start menu [first account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{first_transaction_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 {gift_value} {token_symbol}\n1. Send\n2. My Account\n3. Help" + + - name: Start menu [second account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{second_transaction_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 {gift_value} {token_symbol}\n1. Tuma\n2. Akaunti yangu\n3. Usaidizi" + + - name: Initate transcation attempt [first account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{first_transaction_session_id}" + phoneNumber: "{first_account_phone_number}" + text: "1" + 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: "CON Enter phone number\n0. Back" + + - name: Initate transcation attempt [second account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{second_transaction_session_id}" + phoneNumber: "{second_account_phone_number}" + text: "1" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '33' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON Weka nambari ya simu\n0. Nyuma" + + - name: Enter phone number [first account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{first_transaction_session_id}" + phoneNumber: "{first_account_phone_number}" + text: "1*{second_account_phone_number}" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '24' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON Enter amount\n0. Back" + + - name: Enter phone number [second account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{second_transaction_session_id}" + phoneNumber: "{second_account_phone_number}" + text: "1*{first_account_phone_number}" + headers: + content-type: "application/x-www-form-urlencoded" + method: POST + response: + status_code: + - 200 + headers: + Content-Length: '25' + Content-Type: "text/plain" + verify_response_with: + function: ext.validator:validate_response + extra_kwargs: + expected_response: "CON Weka kiwango\n0. Nyuma" + + - name: Enter transcation amount [first account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{first_transaction_session_id}" + phoneNumber: "{first_account_phone_number}" + text: "1*{second_account_phone_number}*17" + 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 {second_account_given_name} {second_account_family_name} {second_account_phone_number} will receive 17.00 {token_symbol} from {first_account_given_name} {first_account_family_name} {first_account_phone_number}.\nPlease enter your PIN to confirm.\n0. Back" + + - name: Enter transcation amount [second account] + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{second_transaction_session_id}" + phoneNumber: "{second_account_phone_number}" + text: "1*{first_account_phone_number}*25" + 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 {first_account_given_name} {first_account_family_name} {first_account_phone_number} atapokea 25.00 {token_symbol} kutoka kwa {second_account_given_name} {second_account_family_name} {second_account_phone_number}.\nTafadhali weka nambari yako ya siri kudhibitisha.\n0. Nyuma"