Ejemplo n.º 1
0
  public void testViewAccessLogByRole() throws Exception {
    gen.transactionLog3();
    WebConversation wc = login("1", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - Patient Home", wr.getTitle());
    assertLogged(TransactionType.HOME_VIEW, 1L, 0L, "");

    wr = wr.getLinkWith("Access Log").click();
    assertFalse(wr.getText().contains("Exception"));

    WebForm form = wr.getForms()[0];
    form.setParameter("startDate", "02/01/2008");
    form.setParameter("endDate", "09/22/2009");
    form.getSubmitButtons()[0].click();
    form.getScriptableObject().setParameterValue("sortBy", "role");
    wr = form.submit();

    WebTable table = wr.getTableStartingWithPrefix("Date");
    assertTrue(table.getCellAsText(1, 2).contains("Emergency Responder"));
    assertTrue(table.getCellAsText(2, 2).contains("LHCP"));
    assertTrue(table.getCellAsText(3, 2).contains("LHCP"));
    assertTrue(table.getCellAsText(4, 2).contains("LHCP"));
    assertTrue(table.getCellAsText(5, 2).contains("Personal Health Representative"));
    assertTrue(table.getCellAsText(6, 2).contains("UAP"));

    assertLogged(TransactionType.ACCESS_LOG_VIEW, 1L, 0L, "");
  }
Ejemplo n.º 2
0
  /*
   * HCP 9000000000 has viewed PHR of patient 2.
   * Authenticate Patient
   * MID: 2
   * Password: pw
   * Choose option View Access Log
   */
  public void testViewAccessLog1() throws Exception {
    // clear operational profile
    gen.transactionLog();
    // hcp views phr of patient 2
    // login hcp
    WebConversation wc = login("9000000000", "pw");
    WebResponse wr = wc.getCurrentPage();
    assertEquals("iTrust - HCP Home", wr.getTitle());
    assertLogged(TransactionType.HOME_VIEW, 9000000000L, 0L, "");

    // click Edit PHR
    wr = wr.getLinkWith("PHR Information").click();
    assertEquals(
        ADDRESS + "auth/getPatientID.jsp?forward=hcp-uap/editPHR.jsp", wr.getURL().toString());
    // choose patient 2
    WebForm patientForm = wr.getForms()[0];
    patientForm.getScriptableObject().setParameterValue("UID_PATIENTID", "2");
    patientForm.getButtons()[1].click();
    wr = wc.getCurrentPage();
    assertEquals(ADDRESS + "auth/hcp-uap/editPHR.jsp", wr.getURL().toString());
    assertLogged(TransactionType.PATIENT_HEALTH_INFORMATION_VIEW, 9000000000L, 2L, "");

    // login patient 2
    wc = login("2", "pw");
    wr = wc.getCurrentPage();
    assertEquals("iTrust - Patient Home", wr.getTitle());
    assertLogged(TransactionType.HOME_VIEW, 2L, 0L, "");

    // click on View Access Log
    wr = wr.getLinkWith("Access Log").click();
    // check the table that displays the access log

    WebTable table = wr.getTableStartingWithPrefix("Date");

    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    java.util.Date date = new java.util.Date();

    assertTrue(table.getCellAsText(1, 0).contains(dateFormat.format(date)));
    assertEquals("Kelly Doctor", table.getCellAsText(1, 1));
    assertTrue(table.getCellAsText(1, 3).contains("View personal health information"));
    assertLogged(TransactionType.ACCESS_LOG_VIEW, 2L, 0L, "");
  }