def test_create_regular_user(self): print("Create a regular user") assert UserController.create_user({ 'username': '******', 'password': '******', 'firstName': 'John', 'lastName': 'Doe', 'email': '*****@*****.**' }) is not None
def create_user(): print('\033[01m## Creation ##\033[0m') make_test(lambda: UserController.create_user({ 'username': '******', 'password': '******', 'firstName': 'John', 'lastName': 'Doe', 'email': '*****@*****.**' }))(UserTest, 'Normal Creation case', False) make_test(lambda: UserController.create_user({ 'username': '******', 'password': '******', 'firstName': 'John', 'lastName': 'Doe', 'email': '*****@*****.**' }))(UserTest, 'Empty username', True) make_test(lambda: UserController.create_user({ 'username': '******', 'password': '******', 'firstName': 'John', 'lastName': '', 'email': '[email protected]' }))(UserTest, 'Empty field', True) make_test(lambda: UserController.create_user({ 'username': '******', 'password': '******', 'firstName': 'John', 'email': '[email protected]' }))(UserTest, 'Missing Field', True) make_test(lambda: UserController.create_user({ 'username': '******', 'password': '******', 'firstName': 'John', 'lastName':'Doe', 'email': '[email protected]', 'fake:':'fake' }))(UserTest, 'Add Erronate Ignored Field', False) make_test(lambda: UserController.create_user({ 'username': '******', 'password': '******', 'firstName': 'John', 'lastName':'Doe', 'lastName':'Doe1', 'email': '[email protected]', }))(UserTest, 'Add Duplicate Param Takes the last one', False) make_test(lambda: UserController.create_user({ 'username': '******', 'password': '******', 'firstName': 'John', 'lastName': 'Doe', 'email': '[email protected]' }))(UserTest, 'Duplicate username', True) make_test(lambda: UserController.create_user({ 'username': '******', 'password': '******', 'firstName': 'John', 'lastName': 'Doe', 'email': '*****@*****.**' }))(UserTest, 'Duplicate email', True) make_test(lambda: UserController.create_user({ 'username': '******', 'password': '******', 'firstName': 'John', 'lastName': 'Doe', 'email': '*****@*****.**' }))(UserTest, 'Duplicate username and email', True) make_test(lambda: UserController.create_user({ 'username': '******', 'lastName': 'Doe', 'firstName': 'John', 'password': '******', 'email': '*****@*****.**' }))(UserTest, 'Other normal case with unordered fields', False)
def create_user(): created_user = UserController.create_user( {key: request.form.get(key) for key in request.form.keys()}) return ResponseCreated(created_user)