use of org.candlepin.auth.Principal in project candlepin by candlepin.
the class ConsumerResourceCreationTest method registerWithNoReleaseVer.
@Test
public void registerWithNoReleaseVer() {
Principal p = new TrustedUserPrincipal("anyuser");
ConsumerDTO consumer = TestUtil.createConsumerDTO("consumername", null, null, systemDto);
resource.create(consumer, p, USER, owner.getKey(), null, true);
}
use of org.candlepin.auth.Principal in project candlepin by candlepin.
the class ConsumerResourceCreationTest method registerWithNoInstalledProducts.
@Test
public void registerWithNoInstalledProducts() {
Principal p = new TrustedUserPrincipal("anyuser");
ConsumerDTO consumer = TestUtil.createConsumerDTO("consumerName", null, null, systemDto);
resource.create(consumer, p, USER, owner.getKey(), null, true);
}
use of org.candlepin.auth.Principal in project candlepin by candlepin.
the class ConsumerResourceCreationTest method setStatusOnCreate.
@Test
public void setStatusOnCreate() {
Principal p = new TrustedUserPrincipal("anyuser");
ConsumerDTO consumer = TestUtil.createConsumerDTO("consumername", null, null, systemDto);
resource.create(consumer, p, USER, owner.getKey(), null, true);
// Should be called with the consumer, null date (now),
// no compliantUntil, and not update the consumer record
verify(complianceRules).getStatus(any(Consumer.class), eq((Date) null), eq(false), eq(false));
}
use of org.candlepin.auth.Principal in project candlepin by candlepin.
the class ConsumerResourceCreationTest method failIfOnlyActivationKeyDoesNotExistForOrg.
@Test(expected = BadRequestException.class)
public void failIfOnlyActivationKeyDoesNotExistForOrg() {
Principal p = new NoAuthPrincipal();
List<String> keys = new ArrayList<>();
keys.add("NoSuchKey");
ConsumerDTO consumer = TestUtil.createConsumerDTO("sys.example.com", null, null, systemDto);
resource.create(consumer, p, null, owner.getKey(), createKeysString(keys), true);
}
use of org.candlepin.auth.Principal in project candlepin by candlepin.
the class ConsumerResourceCreationTest method createConsumer.
protected ConsumerDTO createConsumer(String consumerName) {
Collection<Permission> perms = new HashSet<>();
perms.add(new OwnerPermission(owner, Access.ALL));
Principal principal = new UserPrincipal(USER, perms, false);
List<String> empty = Collections.emptyList();
return createConsumer(consumerName, principal, empty);
}
Aggregations