From 6c1c05335e9a3f6ac9e825b1932a0320b874e8f9 Mon Sep 17 00:00:00 2001 From: PhilipWafula Date: Wed, 19 May 2021 11:49:26 +0300 Subject: [PATCH] Separates integration tests into individual files. --- .../integration/test_accounts.tavern.yaml | 268 +---------------- .../integration/test_management.tavern.yaml | 33 ++ .../integration/test_transactions.tavern.yaml | 282 ++++++++++++++++++ 3 files changed, 317 insertions(+), 266 deletions(-) create mode 100644 apps/cic-ussd/tests/integration/test_management.tavern.yaml create mode 100644 apps/cic-ussd/tests/integration/test_transactions.tavern.yaml diff --git a/apps/cic-ussd/tests/integration/test_accounts.tavern.yaml b/apps/cic-ussd/tests/integration/test_accounts.tavern.yaml index 528e6006..cc9bee17 100644 --- a/apps/cic-ussd/tests/integration/test_accounts.tavern.yaml +++ b/apps/cic-ussd/tests/integration/test_accounts.tavern.yaml @@ -17,12 +17,10 @@ marks: - 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 + - first + stages: - name: Initiate account creation process [first account]. request: @@ -466,265 +464,3 @@ stages: extra_kwargs: expected_response: "CON Salio {gift_value} {token_symbol}\n1. Tuma\n2. Akaunti yangu\n3. Usaidizi" 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" - - - 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" diff --git a/apps/cic-ussd/tests/integration/test_management.tavern.yaml b/apps/cic-ussd/tests/integration/test_management.tavern.yaml new file mode 100644 index 00000000..99ca7284 --- /dev/null +++ b/apps/cic-ussd/tests/integration/test_management.tavern.yaml @@ -0,0 +1,33 @@ +test_name: Test that account management functionality is intact. +marks: + - usefixtures: + - server_url + - token_symbol + - first_account_phone_number + - second_account_phone_number + - first_account_management_session_id + - second_account_management_session_id + - last + +stages: + - name: Start menu [first menu] + 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" diff --git a/apps/cic-ussd/tests/integration/test_transactions.tavern.yaml b/apps/cic-ussd/tests/integration/test_transactions.tavern.yaml new file mode 100644 index 00000000..c3ce4e12 --- /dev/null +++ b/apps/cic-ussd/tests/integration/test_transactions.tavern.yaml @@ -0,0 +1,282 @@ +test_name: Test that the two test accounts can trade with each other. +marks: + - usefixtures: + - gift_value + - server_url + - token_symbol + - first_account_family_name + - second_account_family_name + - first_account_given_name + - second_account_given_name + - first_account_phone_number + - second_account_phone_number + - first_account_pin_number + - second_account_pin_number + - first_transaction_session_id + - second_transaction_session_id + - first_account_verify_balance_session_id + - second_account_verify_balance_session_id + - second + +stages: + - 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" + + - 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" \ No newline at end of file