Exemplo n.º 1
0
 /** {@inheritDoc} */
 public void setUp() throws Exception {
   super.setUp();
   user.addPermanentRole(RoleFactory.ORG_ADMIN);
   UserFactory.save(user);
   ksdata = KickstartDataTest.createKickstartWithOptions(user.getOrg());
   // ksdata = KickstartDataTest.createKickstartWithChannel(user.getOrg());
   mockRequest = new RhnMockHttpServletRequest();
   mockRequest.setupGetRemoteAddr("127.0.0.1");
   request = new RhnHttpServletRequest(mockRequest);
   helper = new KickstartHelper(request);
 }
  public void testLookupBySession() throws Exception {
    // Still have that weird error creating a test server
    // sometimes in hosted.
    ActivationKey k = createTestActivationKey(user);
    KickstartData ksdata = KickstartDataTest.createKickstartWithOptions(k.getOrg());
    KickstartFactory.saveKickstartData(ksdata);
    KickstartSession sess = KickstartSessionTest.createKickstartSession(ksdata, k.getCreator());
    KickstartFactory.saveKickstartSession(sess);
    k.setKickstartSession(sess);
    ActivationKeyFactory.save(k);
    k = (ActivationKey) reload(k);

    ActivationKey lookedUp = ActivationKeyFactory.lookupByKickstartSession(sess);
    assertNotNull(lookedUp);
  }