+ @Test
+ public void testUserDetailsEditToLog() throws MalformedURLException, IOException {
+ String email = createUniqueName() + "@example.com";
+ String fname = "Först";
+ String lname = "Secönd";
+ int id = createVerifiedUser(fname, lname, email, TEST_PASSWORD);
+ String clientCookie = login(email, TEST_PASSWORD);
+
+ assertEquals(0, logCountAdmin(id));
+ assertEquals(0, logCountUser(clientCookie));
+ // changing both leads to 2 entries
+ assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id, "dobd=1&dobm=2&doby=2000&detailupdate", 0));
+ assertEquals(1, logCountAdmin(id));
+ assertEquals(1, logCountUser(clientCookie));
+
+ // Sending same data keeps same
+ assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id, "dobd=1&dobm=2&doby=2000&detailupdate", 0));
+ assertEquals(1, logCountAdmin(id));
+ assertEquals(1, logCountUser(clientCookie));
+
+ // changing one leads to one entry
+ assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id, "dobd=1&dobm=3&doby=2000&detailupdate", 0));
+ assertEquals(2, logCountAdmin(id));
+ assertEquals(2, logCountUser(clientCookie));
+
+ // changing one leads to one entry
+ assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id, "dobd=2&dobm=3&doby=2000&detailupdate", 0));
+ assertEquals(3, logCountAdmin(id));
+ assertEquals(3, logCountUser(clientCookie));
+
+ // changing none -> no entry
+ assertNull(executeBasicWebInteraction(cookie, SupportUserDetailsPage.PATH + id, "dobd=2&dobm=3&doby=2000&detailupdate", 0));
+ assertEquals(3, logCountAdmin(id));
+ assertEquals(3, logCountUser(clientCookie));
+
+ }
+
+ @Test
+ public void testUserDetailsMyPoints() throws MalformedURLException, IOException {
+ String email = createUniqueName() + "@example.com";
+ String fname = "Först";
+ String lname = "Secönd";
+ int id = createVerifiedUser(fname, lname, email, TEST_PASSWORD);
+ String clientCookie = login(email, TEST_PASSWORD);
+
+ // try to open mypoints as user
+ HttpURLConnection uc = get(clientCookie, SupportUserDetailsPage.PATH + id + "/points");
+
+ assertEquals(403, uc.getResponseCode());
+
+ // enter verification and open mypoints as supporter
+
+ makeAssurer(this.id);
+ String location = createUniqueName();
+ try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `notary` SET `from`=?, `to`=?, `points`=?, `location`=?, `date`=?, `when`=? ")) {
+ ps.setInt(1, this.id);
+ ps.setInt(2, User.getById(id).getPreferredName().getId());
+ ps.setInt(3, 10);
+ ps.setString(4, location);
+ ps.setString(5, "2010-01-01");
+ ps.setTimestamp(6, new Timestamp(System.currentTimeMillis() - DayDate.MILLI_DAY * 200));
+ ps.execute();