Include the performing user in the "Registrar updated" emails

Whenever a registrar is changed via the registrar console, we send out a
notification of that change.

Since we're going to allow Admins and soon Vendors to use the console in
addition to the registrars, it becomes important to know who actually performed
the changes if the registrars complain.

In addition, we will now send notifications for changes in Sandbox since we're
going to actually allow registrars to update sandbox data.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217539534
This commit is contained in:
guyben 2018-10-17 10:10:32 -07:00 committed by jianglai
parent f43125bb04
commit 06ce429c5a
4 changed files with 37 additions and 10 deletions

View file

@ -26,11 +26,15 @@ import static org.mockito.Mockito.when;
import com.google.appengine.api.users.User;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import google.registry.config.RegistryEnvironment;
import google.registry.model.ofy.Ofy;
import google.registry.request.HttpException.ForbiddenException;
import google.registry.request.JsonActionRunner;
import google.registry.request.JsonResponse;
import google.registry.request.ResponseImpl;
import google.registry.request.auth.AuthLevel;
import google.registry.request.auth.AuthResult;
import google.registry.request.auth.UserAuthInfo;
import google.registry.testing.AppEngineRule;
import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule;
@ -88,6 +92,11 @@ public class RegistrarSettingsActionTestCase {
"notification@test.example", "notification2@test.example");
action.sendEmailUtils =
new SendEmailUtils(getGSuiteOutgoingEmailAddress(), getGSuiteOutgoingEmailDisplayName());
action.registryEnvironment = RegistryEnvironment.get();
action.authResult =
AuthResult.create(
AuthLevel.USER,
UserAuthInfo.create(new User("user@email.com", "email.com", "12345"), false));
inject.setStaticField(Ofy.class, "clock", clock);
inject.setStaticField(SendEmailUtils.class, "emailService", emailService);
message = new MimeMessage(Session.getDefaultInstance(new Properties(), null));

View file

@ -1,4 +1,5 @@
The following changes were made to the registrar:
The following changes were made on unittest to the registrar TheRegistrar by user user@email.com:
whoisServer: null -> foo.bar.baz
ipAddressWhitelist: null -> [1.1.1.1/32, 2.2.2.2/32, 4.4.4.4/32]
localizedAddress.street.0: 123 Example Bőulevard -> 123 Street Rd