def test_login_with_wrong_password(self): service = Service() response = service.login({ "email": "*****@*****.**", "password": "******" }) assert isinstance(response, str) assert response == "Invalid Credentials"
def test_login_with_proper_credentials(self): service = Service() response = service.login({ "email": "*****@*****.**", "password": "******" }) assert isinstance(response, object) assert response.token is not None
def test_login_with_invalid_email_id(self): service = Service() response = service.login({ "email": "*****@*****.**", "password": "******" }) assert isinstance(response, str) assert response == "User not available"
def check(): data = request.json try: service = Service() response = service.login(data) if isinstance(response, User): return jsonpickle.encode(response, unpicklable=False), 200 else: return jsonify({'Error': response}), 500 except Exception as e: return jsonify(e), 500
def register(): try: service = Service() data = request.json response = service.register(data) if isinstance(response, User): return jsonpickle.encode(response, unpicklable=False), 200 else: return jsonify({'Error': response}), 500 except Exception as e: return jsonify(e), 500
def test_registration_with_improper_email_id(self): service = Service() response = service.register({ "email": "jhon_gmail.com", "password": "******", "firstName": "Jhon", "lastName": "Smith", "confirmPassword": "******", "dob": "11/02/1994" }) assert isinstance(response, str) assert response == "Please enter proper email address"
def test_registration_with_mismatch_password(self): service = Service() response = service.register({ "email": "*****@*****.**", "password": "******", "firstName": "Jhon", "lastName": "Smith", "confirmPassword": "******", "dob": "11/02/1994" }) assert isinstance(response, str) assert response == "Password did not match"
def test_registration_with_positive_scenarios(self): service = Service() response = service.register({ "email": "*****@*****.**", "password": "******", "firstName": "Jhon", "lastName": "Smith", "confirmPassword": "******", "dob": "11/02/1994" }) assert isinstance(response, object) assert response.user_id is not None