Refactors to use fixtures for test configs.
This commit is contained in:
parent
07fef8df40
commit
06d9612c6c
15
apps/cic-ussd/tests/fixtures/accounts.py
vendored
15
apps/cic-ussd/tests/fixtures/accounts.py
vendored
@ -37,3 +37,18 @@ def first_metadata_entry_session_id() -> str:
|
|||||||
@pytest.fixture(scope='session')
|
@pytest.fixture(scope='session')
|
||||||
def second_metadata_entry_session_id() -> str:
|
def second_metadata_entry_session_id() -> str:
|
||||||
return session_id()
|
return session_id()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope='session')
|
||||||
|
def gift_value(load_config):
|
||||||
|
return load_config.get('TEST_GIFT_VALUE')
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope='session')
|
||||||
|
def server_url(load_config):
|
||||||
|
return load_config.get('TEST_SERVER_URL')
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope='session')
|
||||||
|
def token_symbol(load_config):
|
||||||
|
return load_config.get('TEST_TOKEN_SYMBOL')
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
test_name: Create an account through the cic_user_ussd_server entrypoint.
|
test_name: Create an account through the cic_user_ussd_server entrypoint.
|
||||||
marks:
|
marks:
|
||||||
- usefixtures:
|
- usefixtures:
|
||||||
- generate_phone_number
|
- gift_value
|
||||||
|
- server_url
|
||||||
|
- token_symbol
|
||||||
- generate_session_id
|
- generate_session_id
|
||||||
- first_account_phone_number
|
- first_account_phone_number
|
||||||
- second_account_phone_number
|
- second_account_phone_number
|
||||||
- first_metadata_entry_session_id
|
- first_metadata_entry_session_id
|
||||||
- second_metadata_entry_session_id
|
- second_metadata_entry_session_id
|
||||||
includes:
|
|
||||||
- !include common.yaml
|
|
||||||
stages:
|
stages:
|
||||||
- name: Initiate account creation process [first account].
|
- name: Initiate account creation process [first account].
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{generate_session_id}"
|
sessionId: "{generate_session_id}"
|
||||||
@ -34,7 +34,7 @@ stages:
|
|||||||
|
|
||||||
- name: Initiate account creation process [second account].
|
- name: Initiate account creation process [second account].
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{generate_session_id}"
|
sessionId: "{generate_session_id}"
|
||||||
@ -57,7 +57,7 @@ stages:
|
|||||||
|
|
||||||
- name: Initaite account metadata entry [first account]
|
- name: Initaite account metadata entry [first account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{first_metadata_entry_session_id}"
|
sessionId: "{first_metadata_entry_session_id}"
|
||||||
@ -79,7 +79,7 @@ stages:
|
|||||||
|
|
||||||
- name: Initaite account metadata entry [second account]
|
- name: Initaite account metadata entry [second account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{second_metadata_entry_session_id}"
|
sessionId: "{second_metadata_entry_session_id}"
|
||||||
@ -101,7 +101,7 @@ stages:
|
|||||||
|
|
||||||
- name: Select preferred language [English]
|
- name: Select preferred language [English]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{first_metadata_entry_session_id}"
|
sessionId: "{first_metadata_entry_session_id}"
|
||||||
@ -123,7 +123,7 @@ stages:
|
|||||||
|
|
||||||
- name: Select preferred language [Kiswahili]
|
- name: Select preferred language [Kiswahili]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{second_metadata_entry_session_id}"
|
sessionId: "{second_metadata_entry_session_id}"
|
||||||
@ -145,7 +145,7 @@ stages:
|
|||||||
|
|
||||||
- name: Enter pin number [0000 - first account]
|
- name: Enter pin number [0000 - first account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{first_metadata_entry_session_id}"
|
sessionId: "{first_metadata_entry_session_id}"
|
||||||
@ -167,7 +167,7 @@ stages:
|
|||||||
|
|
||||||
- name: Enter pin number [1212 - second account]
|
- name: Enter pin number [1212 - second account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{second_metadata_entry_session_id}"
|
sessionId: "{second_metadata_entry_session_id}"
|
||||||
@ -189,7 +189,7 @@ stages:
|
|||||||
|
|
||||||
- name: Pin number confirmation [0000 - first account]
|
- name: Pin number confirmation [0000 - first account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{first_metadata_entry_session_id}"
|
sessionId: "{first_metadata_entry_session_id}"
|
||||||
@ -211,7 +211,7 @@ stages:
|
|||||||
|
|
||||||
- name: Pin number confirmation [1212 - second account]
|
- name: Pin number confirmation [1212 - second account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{second_metadata_entry_session_id}"
|
sessionId: "{second_metadata_entry_session_id}"
|
||||||
@ -233,7 +233,7 @@ stages:
|
|||||||
|
|
||||||
- name: Enter first name [Kimani - first account]
|
- name: Enter first name [Kimani - first account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{first_metadata_entry_session_id}"
|
sessionId: "{first_metadata_entry_session_id}"
|
||||||
@ -255,7 +255,7 @@ stages:
|
|||||||
|
|
||||||
- name: Enter first name [Chebet - second account]
|
- name: Enter first name [Chebet - second account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{second_metadata_entry_session_id}"
|
sessionId: "{second_metadata_entry_session_id}"
|
||||||
@ -277,7 +277,7 @@ stages:
|
|||||||
|
|
||||||
- name: Enter last name [Omollo - first account]
|
- name: Enter last name [Omollo - first account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{first_metadata_entry_session_id}"
|
sessionId: "{first_metadata_entry_session_id}"
|
||||||
@ -299,7 +299,7 @@ stages:
|
|||||||
|
|
||||||
- name: Enter last name [Musau - second account]
|
- name: Enter last name [Musau - second account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{second_metadata_entry_session_id}"
|
sessionId: "{second_metadata_entry_session_id}"
|
||||||
@ -321,7 +321,7 @@ stages:
|
|||||||
|
|
||||||
- name: Select gender [Male - first account]
|
- name: Select gender [Male - first account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{first_metadata_entry_session_id}"
|
sessionId: "{first_metadata_entry_session_id}"
|
||||||
@ -343,7 +343,7 @@ stages:
|
|||||||
|
|
||||||
- name: Select gender [Female - second account]
|
- name: Select gender [Female - second account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{second_metadata_entry_session_id}"
|
sessionId: "{second_metadata_entry_session_id}"
|
||||||
@ -365,7 +365,7 @@ stages:
|
|||||||
|
|
||||||
- name: Enter location [Kangemi - first account]
|
- name: Enter location [Kangemi - first account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{first_metadata_entry_session_id}"
|
sessionId: "{first_metadata_entry_session_id}"
|
||||||
@ -387,7 +387,7 @@ stages:
|
|||||||
|
|
||||||
- name: Enter location [Gachororo - second account]
|
- name: Enter location [Gachororo - second account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{second_metadata_entry_session_id}"
|
sessionId: "{second_metadata_entry_session_id}"
|
||||||
@ -409,7 +409,7 @@ stages:
|
|||||||
|
|
||||||
- name: Enter product [Potatoes - first account]
|
- name: Enter product [Potatoes - first account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{first_metadata_entry_session_id}"
|
sessionId: "{first_metadata_entry_session_id}"
|
||||||
@ -427,12 +427,12 @@ stages:
|
|||||||
verify_response_with:
|
verify_response_with:
|
||||||
function: ext.validator:validate_response
|
function: ext.validator:validate_response
|
||||||
extra_kwargs:
|
extra_kwargs:
|
||||||
expected_response: "CON Balance {test_gift_value} {test_token_symbol}\n1. Send\n2. My Account\n3. Help"
|
expected_response: "CON Balance {gift_value} {token_symbol}\n1. Send\n2. My Account\n3. Help"
|
||||||
delay_before: 3
|
delay_before: 5
|
||||||
|
|
||||||
- name: Enter product [Mkalimani - second account]
|
- name: Enter product [Mkalimani - second account]
|
||||||
request:
|
request:
|
||||||
url: "{test_server_url}"
|
url: "{server_url}"
|
||||||
data:
|
data:
|
||||||
serviceCode: "*483*46#"
|
serviceCode: "*483*46#"
|
||||||
sessionId: "{second_metadata_entry_session_id}"
|
sessionId: "{second_metadata_entry_session_id}"
|
||||||
@ -450,5 +450,5 @@ stages:
|
|||||||
verify_response_with:
|
verify_response_with:
|
||||||
function: ext.validator:validate_response
|
function: ext.validator:validate_response
|
||||||
extra_kwargs:
|
extra_kwargs:
|
||||||
expected_response: "CON Salio {test_gift_value} {test_token_symbol}\n1. Tuma\n2. Akaunti yangu\n3. Usaidizi"
|
expected_response: "CON Salio {gift_value} {token_symbol}\n1. Tuma\n2. Akaunti yangu\n3. Usaidizi"
|
||||||
delay_before: 3
|
delay_before: 5
|
||||||
|
Loading…
Reference in New Issue
Block a user