Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MSUE-151] [MSUE-191] - Integration testing files #99

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions examples/reserved_events/test_event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import sift
60 changes: 60 additions & 0 deletions examples/verification_api/test_verification_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import sift

from os import environ as env

# Get the value of API_KEY from environment variable
api_key = env['API_KEY']

client = sift.Client(api_key = api_key, account_id = 'ACCT')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

account_id is probablky optional


def test_verification_send():
sendProperties = {
'$user_id': '[email protected]',
'$send_to': '[email protected]',
'$verification_type': '$email',
'$brand_name': 'MyTopBrand',
'$language': 'en',
'$site_country': 'IN',
'$event': {
'$session_id': 'SOME_SESSION_ID',
'$verified_event': '$login',
'$verified_entity_id': 'SOME_SESSION_ID',
'$reason': '$automated_rule',
'$ip': '192.168.1.1',
'$browser': {
'$user_agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
'$accept_language': 'en-US',
'$content_language': 'en-GB'
}
}
}

response = client.verification_send(sendProperties)
Copy link
Contributor

@viaskal-sift viaskal-sift Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to add assertion mechanism so that the cases fail when a particular condition is not met. For now we can just test the status in the response code which should be 0 for all successful calls

print(response)

def test_verification_resend():
resendProperties = {
'$user_id': '[email protected]',
'$verified_event': '$login',
'$verified_entity_id': 'SOME_SESSION_ID'
}

response = client.verification_resend(resendProperties)
print(response)

def test_verification_check():
checkProperties = {
'$user_id': '[email protected]',
'$code': '354290',
'$verified_event': '$login',
'$verified_entity_id': "SOME_SESSION_ID"
}

response = client.verification_check(checkProperties)
print(response)

# test_verification_send()

# test_verification_resend()

test_verification_check()