Ejemplo n.º 1
0
                PrincipalsTestUtil.assertUpdateUserSucceeds(simong.restContext, simong.user.id, {'email': email}, function() {

                    // Anonymous users cannot delete anything
                    PrincipalsTestUtil.assertDeleteEmailTokenFails(anonymousRestContext, simong.user.id, 401, function() {

                        // Users cannot delete other users their email tokens
                        PrincipalsTestUtil.assertDeleteEmailTokenFails(mrvisser.restContext, simong.user.id, 401, function() {

                            // Tenant administrator cannot delete users from another tenant their email token
                            PrincipalsTestUtil.assertDeleteEmailTokenFails(gtAdminRestContext, simong.user.id, 401, function() {

                                // A user can delete his own pending email verification token
                                PrincipalsTestUtil.assertDeleteEmailTokenSucceeds(simong.restContext, simong.user.id, function(emailForToken) {

                                    email = TestsUtil.generateTestEmailAddress();
                                    PrincipalsTestUtil.assertUpdateUserSucceeds(simong.restContext, simong.user.id, {'email': email}, function() {
                                        // A tenant admin can delete the pending email verification token for users of their tenant
                                        PrincipalsTestUtil.assertDeleteEmailTokenSucceeds(camAdminRestContext, simong.user.id, function(emailForToken) {
                                            return callback();
                                        });
                                    });
                                });
                            });
                        });
                    });
                });
Ejemplo n.º 2
0
                    PrincipalsTestUtil.assertDeleteEmailTokenFails(simong.restContext, 'g:camtest:1234234', 400, function() {

                        // No token should return a 404
                        PrincipalsTestUtil.assertDeleteEmailTokenFails(simong.restContext, simong.user.id, 404, function() {
                            return callback();
                        });
                    });
Ejemplo n.º 3
0
                    PrincipalsTestUtil.assertDeleteEmailTokenSucceeds(simong.restContext, simong.user.id, function() {

                        // Verify a token can't be deleted twice
                        PrincipalsTestUtil.assertDeleteEmailTokenFails(simong.restContext, simong.user.id, 404, function() {
                            return callback();
                        });
                    });
Ejemplo n.º 4
0
            TestsUtil.generateTestUsers(camAdminRestContext, 1, function(err, users, simong) {
                assert.ok(!err);

                // Invalid user id
                PrincipalsTestUtil.assertDeleteEmailTokenFails(simong.restContext, 'not a user id', 400, function() {
                    PrincipalsTestUtil.assertDeleteEmailTokenFails(simong.restContext, 'g:camtest:1234234', 400, function() {

                        // No token should return a 404
                        PrincipalsTestUtil.assertDeleteEmailTokenFails(simong.restContext, simong.user.id, 404, function() {
                            return callback();
                        });
                    });
                });
            });