diff --git a/apps/cic-ussd/tests/integration/test_accounts.tavern.yaml b/apps/cic-ussd/tests/integration/test_accounts.tavern.yaml index 9d78ecf0..528e6006 100644 --- a/apps/cic-ussd/tests/integration/test_accounts.tavern.yaml +++ b/apps/cic-ussd/tests/integration/test_accounts.tavern.yaml @@ -7,14 +7,22 @@ marks: - generate_session_id - first_account_phone_number - second_account_phone_number + - first_account_pin_number + - second_account_pin_number - first_account_family_name - second_account_family_name - first_account_given_name - second_account_given_name + - first_account_location + - second_account_location + - first_account_product + - second_account_product - first_transaction_session_id - second_transaction_session_id - first_metadata_entry_session_id - second_metadata_entry_session_id + - first_account_verify_balance_session_id + - second_account_verify_balance_session_id stages: - name: Initiate account creation process [first account]. request: @@ -149,14 +157,14 @@ stages: extra_kwargs: expected_response: "CON Tafadhali weka PIN ili kudhibiti akaunti yako.\n0. Nyuma" - - name: Enter pin number [0000 - first account] + - name: Enter pin number [{first_account_pin_number} - first account] request: url: "{server_url}" data: serviceCode: "*483*46#" sessionId: "{first_metadata_entry_session_id}" phoneNumber: "{first_account_phone_number}" - text: "1*0000" + text: "1*{first_account_pin_number}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -171,14 +179,14 @@ stages: extra_kwargs: expected_response: "CON Enter your PIN again\n0. Back" - - name: Enter pin number [1212 - second account] + - name: Enter pin number [second_account_pin_number - second account] request: url: "{server_url}" data: serviceCode: "*483*46#" sessionId: "{second_metadata_entry_session_id}" phoneNumber: "{second_account_phone_number}" - text: "2*1212" + text: "2*{second_account_pin_number}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -193,14 +201,14 @@ stages: extra_kwargs: expected_response: "CON Weka PIN yako tena\n0. Nyuma" - - name: Pin number confirmation [0000 - first account] + - name: Pin number confirmation [first_account_pin_number - 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" + text: "1*{first_account_pin_number}*{first_account_pin_number}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -215,14 +223,14 @@ stages: extra_kwargs: expected_response: "CON Enter first name\n0. Back" - - name: Pin number confirmation [1212 - second account] + - name: Pin number confirmation [{second_account_pin_number} - 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" + text: "2*{second_account_pin_number}*{second_account_pin_number}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -244,7 +252,7 @@ stages: serviceCode: "*483*46#" sessionId: "{first_metadata_entry_session_id}" phoneNumber: "{first_account_phone_number}" - text: "1*0000*0000*{first_account_given_name}" + text: "1*{first_account_pin_number}*{first_account_pin_number}*{first_account_given_name}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -266,7 +274,7 @@ stages: serviceCode: "*483*46#" sessionId: "{second_metadata_entry_session_id}" phoneNumber: "{second_account_phone_number}" - text: "2*1212*1212*{second_account_given_name}" + text: "2*{second_account_pin_number}*{second_account_pin_number}*{second_account_given_name}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -288,7 +296,7 @@ stages: serviceCode: "*483*46#" sessionId: "{first_metadata_entry_session_id}" phoneNumber: "{first_account_phone_number}" - text: "1*0000*0000*{first_account_given_name}*{first_account_family_name}" + text: "1*{first_account_pin_number}*{first_account_pin_number}*{first_account_given_name}*{first_account_family_name}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -310,7 +318,7 @@ stages: serviceCode: "*483*46#" sessionId: "{second_metadata_entry_session_id}" phoneNumber: "{second_account_phone_number}" - text: "2*1212*1212*{second_account_given_name}*{second_account_family_name}" + text: "2*{second_account_pin_number}*{second_account_pin_number}*{second_account_given_name}*{second_account_family_name}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -332,7 +340,7 @@ stages: serviceCode: "*483*46#" sessionId: "{first_metadata_entry_session_id}" phoneNumber: "{first_account_phone_number}" - text: "1*0000*0000*Kimani*Omollo*1" + text: "1*{first_account_pin_number}*{first_account_pin_number}*{first_account_given_name}*{first_account_family_name}*1" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -354,7 +362,7 @@ stages: serviceCode: "*483*46#" sessionId: "{second_metadata_entry_session_id}" phoneNumber: "{second_account_phone_number}" - text: "2*1212*1212*Chebet*Musau*2" + text: "2*{second_account_pin_number}*{second_account_pin_number}*{second_account_given_name}*{second_account_family_name}*2" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -369,14 +377,14 @@ stages: extra_kwargs: expected_response: "CON Weka eneo lako\n0. Nyuma" - - name: Enter location [Kangemi - first account] + - name: Enter location [first_account_location - 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*1*Kangemi" + text: "1*{first_account_pin_number}*{first_account_pin_number}*{first_account_given_name}*{first_account_family_name}*1*{first_account_location}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -391,14 +399,14 @@ stages: extra_kwargs: expected_response: "CON Please enter a product or service you offer\n0. Back" - - name: Enter location [Gachororo - second account] + - name: Enter location [second_account_location - 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*2*Gachororo" + text: "2*{second_account_pin_number}*{second_account_pin_number}*{second_account_given_name}*{second_account_family_name}*2*{second_account_location}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -413,14 +421,14 @@ stages: extra_kwargs: expected_response: "CON Tafadhali weka bidhaa ama huduma unauza\n0. Nyuma" - - name: Enter product [Potatoes - first account] + - name: Enter product [first_account_product - 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*1*Kangemi*Potatoes" + text: "1*{first_account_pin_number}*{first_account_pin_number}*{first_account_given_name}*{first_account_family_name}*1*{first_account_location}*{first_account_product}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -436,14 +444,14 @@ stages: expected_response: "CON Balance {gift_value} {token_symbol}\n1. Send\n2. My Account\n3. Help" delay_before: 10 - - name: Enter product [Mkalimani - second account] + - name: Enter product [second_account_product - 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*2*Gachororo*Mkalimani" + text: "2*{second_account_pin_number}*{second_account_pin_number}*{second_account_given_name}*{second_account_family_name}*2*{second_account_location}*{second_account_product}" headers: content-type: "application/x-www-form-urlencoded" method: POST @@ -632,3 +640,91 @@ stages: 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" + + - name: Pin to authorize transaction [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*{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 Your request has been sent. {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}.\n00. Back\n99. Exit" + + - name: Pin to authorize transaction [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*{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 Ombi lako limetumwa. {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}.\n00. Nyuma\n99. Ondoka" + + - name: Verify balance changes [first account] + delay_before: 10 + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{first_account_verify_balance_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: Verify balance changes [first account] + delay_before: 10 + request: + url: "{server_url}" + data: + serviceCode: "*483*46#" + sessionId: "{second_account_verify_balance_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"