Example #1
0
                                        UsersTestsUtil.assertUpdateUserFails(simon.client, simon.profile.id, {'emailPreference': 'lolwhat'}, 400, function() {

                                            // Too long displayName
                                            var longDisplayName = TestsUtil.generateString(256);
                                            UsersTestsUtil.assertUpdateUserFails(simon.client, simon.profile.id, {'displayName': longDisplayName}, 400, function() {
                                                return callback();
                                            });
                                        });
Example #2
0
            UsersTestsUtil.assertCreateUserFails(global.tests.admins.cam2014.client, null, email, 'password', {'emailPreference': 'immediate'}, 400, function() {

                // Invalid display name
                var longDisplayName = TestsUtil.generateString(256);
                UsersTestsUtil.assertCreateUserFails(global.tests.admins.cam2014.client, longDisplayName, email, 'password', {'emailPreference': 'immediate'}, 400, function() {

                    // Missing email
                    UsersTestsUtil.assertCreateUserFails(global.tests.admins.cam2014.client, 'displayName', null, 'password', {'emailPreference': 'immediate'}, 400, function() {

                        // Invalid email
                        UsersTestsUtil.assertCreateUserFails(global.tests.admins.cam2014.client, 'displayName', 'not an email address', 'password', {'emailPreference': 'immediate'}, 400, function() {

                            // Missing password
                            UsersTestsUtil.assertCreateUserFails(global.tests.admins.cam2014.client, 'displayName', email, null, {'emailPreference': 'immediate'}, 400, function() {

                                // Invalid password
                                UsersTestsUtil.assertCreateUserFails(global.tests.admins.cam2014.client, 'displayName', email, '12', {'emailPreference': 'immediate'}, 400, function() {

                                    // Invalid email preference
                                    UsersTestsUtil.assertCreateUserFails(global.tests.admins.cam2014.client, 'displayName', email, 'password', {'emailPreference': 'uwotm8'}, 400, function() {

                                        // Invalid application id
                                        TestsUtil.getGlobalAdminRestClient(function(globalAdminClient) {
                                            UsersTestsUtil.assertCreateUserFails(globalAdminClient, 'displayName', email, 'password', {'emailPreference': 'immediate', 'app': 'Not a number'}, 400, function() {
                                                UsersTestsUtil.assertCreateUserFails(globalAdminClient, 'displayName', email, 'password', {'emailPreference': 'immediate', 'app': -1}, 404, function() {
                                                    UsersTestsUtil.assertCreateUserFails(globalAdminClient, 'displayName', email, 'password', {'emailPreference': 'immediate', 'app': 1231231}, 404, function() {
                                                        return callback();
                                                    });
                                                });
                                            });
                                        });
                                    });
                                });
                            });
                        });
                    });
                });
            });