Example #1
0
                        PrincipalsTestUtil.assertUserEmailMappingEquals('*****@*****.**', [user.id], function() {

                            // Update the email address through a CSV import
                            PrincipalsTestUtil.importUsers(globalAdminRestContext, tenant.alias, getDataFileStream('users-emails-updated.csv'), 'local', true, function(err) {
                                assert.ok(!err);

                                RestAPI.User.getMe(restContext, function(err, user) {
                                    assert.ok(!err);
                                    assert.strictEqual(user.email, '*****@*****.**');

                                    // Assert there's a mapping for the new email address
                                    PrincipalsTestUtil.assertUserEmailMappingEquals('*****@*****.**', [user.id], function() {

                                        // Assert there's no mapping for the old email address
                                        PrincipalsTestUtil.assertUserEmailMappingEquals('*****@*****.**', [], function() {
                                            return callback();
                                        });
                                    });
                                });
                            });
                        });
Example #2
0
            TestsUtil.createTenantWithAdmin(tenantAlias, tenantHost, function(err, tenant, tenantAdminRestContext) {
                assert.ok(!err);

                // Import users as a global admin using a local authentication strategy
                PrincipalsTestUtil.importUsers(globalAdminRestContext, tenant.alias, getDataFileStream('users-emails.csv'), 'local', null, function(err) {
                    assert.ok(!err);

                    // Verify the user's email address is verified
                    var restContext = TestsUtil.createTenantRestContext(tenant.host, 'users-emails-abc123', 'password');
                    RestAPI.User.getMe(restContext, function(err, user) {
                        assert.ok(!err);
                        assert.strictEqual(user.email, '*****@*****.**');

                        // Assert there's a mapping for the email address
                        PrincipalsTestUtil.assertUserEmailMappingEquals('*****@*****.**', [user.id], function() {

                            // Update the email address through a CSV import
                            PrincipalsTestUtil.importUsers(globalAdminRestContext, tenant.alias, getDataFileStream('users-emails-updated.csv'), 'local', true, function(err) {
                                assert.ok(!err);

                                RestAPI.User.getMe(restContext, function(err, user) {
                                    assert.ok(!err);
                                    assert.strictEqual(user.email, '*****@*****.**');

                                    // Assert there's a mapping for the new email address
                                    PrincipalsTestUtil.assertUserEmailMappingEquals('*****@*****.**', [user.id], function() {

                                        // Assert there's no mapping for the old email address
                                        PrincipalsTestUtil.assertUserEmailMappingEquals('*****@*****.**', [], function() {
                                            return callback();
                                        });
                                    });
                                });
                            });
                        });
                    });
                });
            });