use of org.candlepin.model.UeberCertificateCurator in project candlepin by candlepin.
the class OwnerResourceTest method testCreateUeberCertificateFromScratch.
@Test
public void testCreateUeberCertificateFromScratch() {
Principal principal = setupPrincipal(owner, Access.ALL);
Owner owner = TestUtil.createOwner();
UeberCertificate entCert = mock(UeberCertificate.class);
OwnerCurator oc = mock(OwnerCurator.class);
ProductCurator pc = mock(ProductCurator.class);
ConsumerCurator cc = mock(ConsumerCurator.class);
EntitlementCurator ec = mock(EntitlementCurator.class);
CandlepinPoolManager cpm = mock(CandlepinPoolManager.class);
EntitlementCertificateCurator ecc = mock(EntitlementCertificateCurator.class);
UeberCertificateCurator uc = mock(UeberCertificateCurator.class);
UeberCertificateGenerator ucg = mock(UeberCertificateGenerator.class);
OwnerResource resource = new OwnerResource(oc, pc, null, cc, i18n, null, null, null, null, null, cpm, null, null, null, null, null, ecc, ec, uc, ucg, null, null, null, null, null, null, null, null, null, this.modelTranslator);
when(oc.lookupByKey(eq("admin"))).thenReturn(owner);
when(ucg.generate(eq(owner.getKey()), eq(principal))).thenReturn(entCert);
UeberCertificate result = resource.createUeberCertificate(principal, owner.getKey());
assertEquals(entCert, result);
}
use of org.candlepin.model.UeberCertificateCurator in project candlepin by candlepin.
the class OwnerResourceTest method testCreateUeberCertificateRegenerate.
@Test
public void testCreateUeberCertificateRegenerate() {
Principal principal = setupPrincipal(owner, Access.ALL);
Owner owner = TestUtil.createOwner();
UeberCertificate entCert = mock(UeberCertificate.class);
OwnerCurator oc = mock(OwnerCurator.class);
ProductCurator pc = mock(ProductCurator.class);
ConsumerCurator cc = mock(ConsumerCurator.class);
EntitlementCurator ec = mock(EntitlementCurator.class);
CandlepinPoolManager cpm = mock(CandlepinPoolManager.class);
EntitlementCertificateCurator ecc = mock(EntitlementCertificateCurator.class);
UeberCertificateCurator uc = mock(UeberCertificateCurator.class);
UeberCertificateGenerator ucg = mock(UeberCertificateGenerator.class);
OwnerResource resource = new OwnerResource(oc, pc, null, cc, i18n, null, null, null, null, null, cpm, null, null, null, null, null, ecc, ec, uc, ucg, null, null, null, null, null, null, null, null, null, this.modelTranslator);
when(ucg.generate(eq(owner.getKey()), eq(principal))).thenReturn(entCert);
UeberCertificate result = resource.createUeberCertificate(principal, owner.getKey());
assertEquals(entCert, result);
}
Aggregations