Compare commits

...

12 Commits

10 changed files with 598 additions and 8 deletions

View File

@ -71,7 +71,7 @@ def process_exit_insufficient_balance(display_key: str, user: Account, ussd_sess
operational_balance = get_cached_operational_balance(blockchain_address=user.blockchain_address) operational_balance = get_cached_operational_balance(blockchain_address=user.blockchain_address)
# compile response data # compile response data
user_input = ussd_session.get('user_input').split('*')[-1] user_input = ussd_session.get('session_data').get('transaction_amount')
transaction_amount = to_wei(value=int(user_input)) transaction_amount = to_wei(value=int(user_input))
token_symbol = 'SRF' token_symbol = 'SRF'
@ -86,7 +86,7 @@ def process_exit_insufficient_balance(display_key: str, user: Account, ussd_sess
amount=from_wei(transaction_amount), amount=from_wei(transaction_amount),
token_symbol=token_symbol, token_symbol=token_symbol,
recipient_information=tx_recipient_information, recipient_information=tx_recipient_information,
token_balance=operational_balance token_balance=operational_balance,
) )
@ -401,7 +401,11 @@ def process_request(user_input: str, user: Account, ussd_session: Optional[dict]
'exit_invalid_pin', 'exit_invalid_pin',
'exit_invalid_new_pin', 'exit_invalid_new_pin',
'exit_pin_mismatch', 'exit_pin_mismatch',
'exit_invalid_request' 'exit_invalid_request',
"exit_insufficient_balance",
"exit_successful_transaction",
"help",
"complete"
] and person_metadata is not None: ] and person_metadata is not None:
return UssdMenu.find_by_name(name='start') return UssdMenu.find_by_name(name='start')
else: else:

View File

@ -45,7 +45,15 @@ def is_authorized_pin(state_machine_data: Tuple[str, dict, Account]) -> bool:
:rtype: bool :rtype: bool
""" """
user_input, ussd_session, user = state_machine_data user_input, ussd_session, user = state_machine_data
pin_validity = user.verify_password(password=user_input)
if pin_validity is True:
return user.verify_password(password=user_input) return user.verify_password(password=user_input)
else:
# bump number for failed attempts
user.failed_pin_attempts += 1
Account.session.add(user)
Account.session.commit()
return pin_validity
def is_locked_account(state_machine_data: Tuple[str, dict, Account]) -> bool: def is_locked_account(state_machine_data: Tuple[str, dict, Account]) -> bool:

View File

@ -8,7 +8,7 @@ WORKDIR /usr/src
ARG pip_extra_index_url_flag='--extra-index-url https://pip.grassrootseconomics.net:8433' ARG pip_extra_index_url_flag='--extra-index-url https://pip.grassrootseconomics.net:8433'
RUN apt-get update && \ RUN apt-get update && \
apt install -y gcc gnupg libpq-dev wget make g++ gnupg bash procps git apt install -y gcc gnupg libpq-dev wget make g++ gnupg bash procps git python-pycurl libcurl4-openssl-dev libssl-dev
# create secrets directory # create secrets directory
RUN mkdir -vp pgp/keys RUN mkdir -vp pgp/keys

View File

@ -0,0 +1,281 @@
- config:
- testset: "account tests"
- test:
- group: "accounts"
- name: "create account [EN]"
- url: "/"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek020", "text": ""}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"175"}
- compare: {"raw_body":"", "comparator":"contains", expected: "END Your account is being created. You will receive an SMS when your account is ready.\nAkaunti yako ya Sarafu inatayarishwa. Utapokea ujumbe wa SMS akaunti yako ikiwa tayari.\n" }
- test:
- group: "accounts"
- name: "create account [SW]"
- url: "/"
- method: "POST"
- delay: 2
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek021", "text": ""}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"175"}
- compare: {"raw_body":"", "comparator":"contains", expected: "END Your account is being created. You will receive an SMS when your account is ready.\nAkaunti yako ya Sarafu inatayarishwa. Utapokea ujumbe wa SMS akaunti yako ikiwa tayari.\n" }
- test:
- group: "accounts"
- name: "select preferred language prompt [EN]"
- url: "/"
- method: "POST"
- delay: 5 # delay to allow celery tasks to run to create account
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek022", "text": ""}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"53"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Welcome to Sarafu\n1. English\n2. Kiswahili\n3. Help"}
- test:
- group: "accounts"
- name: "select preferred language prompt [SW]"
- url: "/"
- method: "POST"
- delay: 5 # delay to allow celery tasks to run to create account
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek023", "text": ""}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"53"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Welcome to Sarafu\n1. English\n2. Kiswahili\n3. Help"}
- test:
- group: "accounts"
- name: "pin entry [EN]"
- url: "/"
- delay: 2 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek022", "text": "1"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"54"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Please enter a PIN to manage your account.\n0. Back"}
- test:
- group: "accounts"
- name: "pin entry [SW]"
- url: "/"
- delay: 2 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek023", "text": "2"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"59"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Tafadhali weka PIN ili kudhibiti akaunti yako.\n0. Nyuma"}
- test:
- group: "accounts"
- name: "pin entry confirmation [EN]"
- url: "/"
- delay: 2 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek022", "text": "1*0000"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"32"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Enter your PIN again\n0. Back"}
- test:
- group: "accounts"
- name: "pin entry confirmation [SW]"
- url: "/"
- delay: 2 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek023", "text": "2*1111"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"31"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Weka PIN yako tena\n0. Nyuma"}
- test:
- group: "accounts"
- name: "given names entry[EN]"
- url: "/"
- delay: 3 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek022", "text": "1*0000*0000"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"28"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Enter first name\n0. Back"}
- test:
- group: "accounts"
- name: "given names entry[SW]"
- url: "/"
- delay: 3 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek023", "text": "2*1111*1111"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"37"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Weka jina lako la kwanza\n0. Nyuma"}
- test:
- group: "accounts"
- name: "family name entry[EN]"
- url: "/"
- delay: 2 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek022", "text": "1*0000*0000*Kimani"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"27"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Enter last name\n0. Back"}
- test:
- group: "accounts"
- name: "family name entry[SW]"
- url: "/"
- delay: 2 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek023", "text": "2*1111*1111*Chebet"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"37"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Weka jina lako la mwisho\n0. Nyuma"}
- test:
- group: "accounts"
- name: "gender selection[EN]"
- url: "/"
- delay: 2 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek022", "text": "1*0000*0000*Kimani*Omollo"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"42"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Enter gender\n1. Male\n2. Female\n0. Back"}
- test:
- group: "accounts"
- name: "gender selection[SW]"
- url: "/"
- delay: 2 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek023", "text": "2*1111*1111*Chebet*Musau"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"53"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Weka jinsia yako\n1. Mwanaume\n2. Mwanamke\n0. Nyuma"}
- test:
- group: "accounts"
- name: "location entry[EN]"
- url: "/"
- delay: 2 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek022", "text": "1*0000*0000*Kimani*Omollo*1"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"26"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Enter location\n0. Back"}
- test:
- group: "accounts"
- name: "location entry[SW]"
- url: "/"
- delay: 2 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek023", "text": "2*1111*1111*Chebet*Musau*2"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"27"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Weka eneo lako\n0. Nyuma"}
- test:
- group: "accounts"
- name: "product entry[EN]"
- url: "/"
- delay: 2 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek022", "text": "1*0000*0000*Kimani*Omollo*1*Kangemi"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"55"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Please enter a product or service you offer\n0. Back"}
- test:
- group: "accounts"
- name: "product entry[SW]"
- url: "/"
- delay: 2 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek023", "text": "2*1111*1111*Chebet*Musau*2*Chebarbar"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"52"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Tafadhali weka bidhaa ama huduma unauza\n0. Nyuma"}
- test:
- group: "accounts"
- name: "start menu[EN]"
- url: "/"
- delay: 2 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek022", "text": "1*0000*0000*Kimani*Omollo*1*Kangemi*Potatoes"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"51"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Balance 50.00 SRF\n1. Send\n2. My Account\n3. Help"}
- test:
- group: "accounts"
- name: "start menu[EN]"
- url: "/"
- delay: 2 # delay
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek023", "text": "2*1111*1111*Chebet*Musau*2*Musau*Mandazi"}'
- headers: {'Content-Type': 'application/json'}
- expected_status: [200]
- validators:
- compare: {"header": "content-type", "comparator": "str_eq", "expected":"text/plain"}
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"56"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Salio 50.00 SRF\n1. Tuma\n2. Akaunti yangu\n3. Usaidizi"}

View File

@ -0,0 +1,9 @@
#!/bin/bash
if [ -z "$TEST_SERVER_URL" ];
then
echo "The test server url is not set !"
exit 1
fi
pyresttest "$TEST_SERVER_URL" ./test_suite.yml --log debug

View File

@ -0,0 +1,2 @@
- import: account_tests.yml
- import: transaction_tests.yml

View File

@ -0,0 +1,285 @@
- config:
- testset: "transaction tests"
- test:
- group: "transactions"
- name: "send tokens[EN]"
- url: "/"
- delay: "3"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek024", "text": ""}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: { "header": "content-length", "comparator": "str_eq", "expected": "51" }
- compare: { "raw_body": "", "comparator": "str_eq", expected: "CON Balance 50.00 SRF\n1. Send\n2. My Account\n3. Help" }
- test:
- group: "transactions"
- name: "send tokens[SW]"
- url: "/"
- delay: "3"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek025", "text": ""}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"56"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Salio 50.00 SRF\n1. Tuma\n2. Akaunti yangu\n3. Usaidizi"}
- test:
- group: "transactions"
- name: "enter recipients phone number[EN]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek024", "text": "1"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: { "header": "content-length", "comparator": "str_eq", "expected": "30" }
- compare: { "raw_body": "", "comparator": "str_eq", expected: "CON Enter phone number\n0. Back" }
- test:
- group: "transactions"
- name: "enter recipients phone number[SW]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek025", "text": "1"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"33"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Weka nambari ya simu\n0. Nyuma"}
- test:
- group: "transactions"
- name: "enter token amount[EN]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek024", "text": "1*0712345679"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: { "header": "content-length", "comparator": "str_eq", "expected": "24" }
- compare: { "raw_body": "", "comparator": "str_eq", expected: "CON Enter amount\n0. Back" }
- test:
- group: "transactions"
- name: "enter token amount[SW]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek025", "text": "1*0712345678"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"25"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Weka kiwango\n0. Nyuma"}
- test:
- group: "transactions"
- name: "transaction pin authorization[EN]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek024", "text": "1*0712345679*15"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: { "header": "content-length", "comparator": "str_eq", "expected": "129" }
- compare: { "raw_body": "", "comparator": "str_eq", expected: "CON Chebet Musau +254712345679 will receive 15.00 SRF from Kimani Omollo +254712345678.\nPlease enter your PIN to confirm.\n0. Back" }
- test:
- group: "transactions"
- name: "transaction pin authorization[SW]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek025", "text": "1*0712345678*18"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"148"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Kimani Omollo +254712345678 atapokea 18.00 SRF kutoka kwa Chebet Musau +254712345679.\nTafadhali weka nambari yako ya siri kudhibitisha.\n0. Nyuma"}
- test:
- group: "transactions"
- name: "transaction pin authorization-invalid-pin[EN]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek024", "text": "1*0712345679*15*6987"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: { "header": "content-length", "comparator": "str_eq", "expected": "65" }
- compare: { "raw_body": "", "comparator": "str_eq", expected: "CON Please enter your PIN. You have 2 attempts remaining.\n0. Back" }
- test:
- group: "transactions"
- name: "transaction pin authorization-invalid-pin[SW]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek025", "text": "1*0712345678*18*7845"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"62"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Weka nambari ya siri. Una majaribio 2 yaliyobaki.\n0. Nyuma"}
- test:
- group: "transactions"
- name: "transaction pin authorization-valid-pin[EN]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek024", "text": "1*0712345679*15*6987*0000"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: { "header": "content-length", "comparator": "str_eq", "expected": "133" }
- compare: { "raw_body": "", "comparator": "str_eq", expected: "CON Your request has been sent. Chebet Musau +254712345679 will receive 15.00 SRF from Kimani Omollo +254712345678.\n00. Back\n99. Exit" }
- test:
- group: "transactions"
- name: "transaction pin authorization-valid-pin[SW]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek025", "text": "1*0712345678*18*7845*1111"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"131"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Ombi lako limetumwa. Kimani Omollo +254712345678 atapokea 18.00 SRF kutoka kwa Chebet Musau +254712345679.\n00. Nyuma\n99. Ondoka"}
- test:
- group: "transactions"
- name: "send tokens-2[EN]"
- url: "/"
- delay: "3"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek026", "text": ""}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: { "header": "content-length", "comparator": "str_eq", "expected": "51" }
- compare: { "raw_body": "", "comparator": "str_eq", expected: "CON Balance 53.00 SRF\n1. Send\n2. My Account\n3. Help" }
- test:
- group: "transactions"
- name: "send tokens-2[SW]"
- url: "/"
- delay: "3"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek027", "text": ""}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"56"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Salio 47.00 SRF\n1. Tuma\n2. Akaunti yangu\n3. Usaidizi"}
- test:
- group: "transactions"
- name: "enter recipients phone number-2[EN]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek026", "text": "1"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: { "header": "content-length", "comparator": "str_eq", "expected": "30" }
- compare: { "raw_body": "", "comparator": "str_eq", expected: "CON Enter phone number\n0. Back" }
- test:
- group: "transactions"
- name: "enter recipients phone number-2[SW]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek027", "text": "1"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"33"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Weka nambari ya simu\n0. Nyuma"}
- test:
- group: "transactions"
- name: "enter token amount-2[EN]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek026", "text": "1*0712345679"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: { "header": "content-length", "comparator": "str_eq", "expected": "24" }
- compare: { "raw_body": "", "comparator": "str_eq", expected: "CON Enter amount\n0. Back" }
- test:
- group: "transactions"
- name: "enter token amount-2[SW]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek027", "text": "1*0712345678"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"25"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Weka kiwango\n0. Nyuma"}
- test:
- group: "transactions"
- name: "transaction pin authorization-2[EN]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345678", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek026", "text": "1*0712345679*850"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: { "header": "content-length", "comparator": "str_eq", "expected": "156" }
- compare: { "raw_body": "", "comparator": "str_eq", expected: "CON Payment of 850.00 SRF to Chebet Musau +254712345679 has failed due to insufficient balance.\nYour Sarafu-Network balances is: 53.00 SRF\n00. Back\n99. Exit"}
- test:
- group: "transactions"
- name: "transaction pin authorization-2[SW]"
- url: "/"
- delay: "2"
- method: "POST"
- body: '{"serviceCode": "*483*46#", "phoneNumber": "+254712345679", "sessionId": "AT_Idjhfuvelw64ffbweiy73nd5vnek027", "text": "1*0712345678*1800"}'
- headers: { 'Content-Type': 'application/json' }
- expected_status: [ 200 ]
- validators:
- compare: { "header": "content-type", "comparator": "str_eq", "expected": "text/plain" }
- compare: {"header": "content-length", "comparator": "str_eq", "expected":"186"}
- compare: {"raw_body":"", "comparator":"str_eq", expected: "CON Malipo ya 1800.00 SRF kwa Kimani Omollo +254712345678 halijakamilika kwa sababu salio lako haitoshi.\nAkaunti yako ya Sarafu-Network ina salio ifuatayo: 47.00 SRF\n00. Nyuma\n99. Ondoka"}

View File

@ -2,3 +2,4 @@ cic_base[full_graph]~=0.1.2a68
cic-eth~=0.11.0b3 cic-eth~=0.11.0b3
cic-notify~=0.4.0a4 cic-notify~=0.4.0a4
cic-types~=0.1.0a10 cic-types~=0.1.0a10
pyresttest==1.7.1

View File

@ -154,8 +154,8 @@ en:
00. Back 00. Back
99. Exit 99. Exit
exit_insufficient_balance: |- exit_insufficient_balance: |-
CON Payment of %{amount} %{token_symbol} to %{recipient_information} has failed due to insufficent balance. CON Payment of %{amount} %{token_symbol} to %{recipient_information} has failed due to insufficient balance.
Your Sarafu-Network balances is: %{token_balance} Your Sarafu-Network balances is: %{token_balance} %{token_symbol}
00. Back 00. Back
99. Exit 99. Exit
help: |- help: |-

View File

@ -155,7 +155,7 @@ sw:
99. Ondoka 99. Ondoka
exit_insufficient_balance: |- exit_insufficient_balance: |-
CON Malipo ya %{amount} %{token_symbol} kwa %{recipient_information} halijakamilika kwa sababu salio lako haitoshi. CON Malipo ya %{amount} %{token_symbol} kwa %{recipient_information} halijakamilika kwa sababu salio lako haitoshi.
Akaunti yako ya Sarafu-Network ina salio ifuatayo: %{token_balance} Akaunti yako ya Sarafu-Network ina salio ifuatayo: %{token_balance} %{token_symbol}
00. Nyuma 00. Nyuma
99. Ondoka 99. Ondoka
help: |- help: |-