def test_topup_process(): com.post( "/topup", headers, { 'mobileNo': "+919845104104", 'senderMobileNo': '+919845104105', 'product': 100, 'retailPrice': 8.9, 'serviceFee': '1' }).status_code == 200
def test_user_report_with_out_role(): response = com.post("/reports/user",headers, {'from': "2017-1-1",'to':'2018-1-1','type':'csv'}) assert response.status_code == 200 lines = response.content.split("\n") for line in lines[1:len(lines) - 1]: tokens = line.split(",")
def test_create_account(): name = 'test' + str(int(round(time.time() * 1000))) + "@maxmoney.com" response = com.post( "/topup/accounts/account", headers, { 'creditLimit': 1000, 'creditAllowed': 'true', 'accountName': name, 'amount': 1000, 'status': 'Active' }) assert response.status_code == 200 assert response.json()['creditLimit'] == 1000 response = com.post( "/topup/accounts/account", headers, { 'creditLimit': 1000, 'creditAllowed': 'true', 'accountName': name, 'amount': 1000, 'status': 'Active' }) assert response.status_code == 400
def test_user_report_with_invalid_date_format(): response = com.post("/reports/user", headers, {'from': '1-1-2017', 'to': '30-1-2018', 'type': 'csv', 'role': 'customer'}) assert response.status_code == 400
def test_user_report_with_invalid_to_date(): response = com.post("/reports/user", headers, {'from': '2017-1-1', 'to': '3000-1-1', 'type': 'csv', 'role': 'customer'}) assert response.status_code == 200
def test_user_report_with_out_from_date(): response = com.post("/reports/user", headers, {'from': '', 'to': '2018-1-1', 'type': 'csv', 'role': 'customer'}) assert response.status_code == 200
def test_user_report_with_junk_from(): response = com.post("/reports/user",headers, {'from': "abcd",'to':'2018-1-1','type':'csv','role':'customer'}) assert response.status_code == 400
def test_role(role): response = com.post("/reports/user", headers, data={'from': "2017-1-1", 'to': '2018-1-1', 'type': 'csv', 'role': role}) assert response.status_code == 200
def test_content_type(): response = com.post("/reports/user", headers, data={'from': "2017-1-1", 'to': '2018-1-1', 'type': 'csv', 'role': 'financeManager'})