use of org.candlepin.auth.Principal in project candlepin by candlepin.
the class ConsumerResourceCreationTest method registerWithEmptyReleaseVer.
@Test
public void registerWithEmptyReleaseVer() {
Principal p = new TrustedUserPrincipal("anyuser");
ConsumerDTO consumer = TestUtil.createConsumerDTO("consumername", null, null, systemDto);
consumer.setReleaseVersion("");
resource.create(consumer, p, USER, owner.getKey(), null, true);
}
use of org.candlepin.auth.Principal in project candlepin by candlepin.
the class ConsumerResourceCreationTest method registerWithNullReleaseVer.
@Test
public void registerWithNullReleaseVer() {
Principal p = new TrustedUserPrincipal("anyuser");
ConsumerDTO consumer = TestUtil.createConsumerDTO("consumername", null, null, systemDto);
consumer.setReleaseVersion(null);
resource.create(consumer, p, USER, owner.getKey(), null, true);
}
use of org.candlepin.auth.Principal in project candlepin by candlepin.
the class ConsumerResourceCreationTest method cannotMixUsernameWithActivationKeys.
@Test(expected = BadRequestException.class)
public void cannotMixUsernameWithActivationKeys() {
Principal p = new NoAuthPrincipal();
List<String> keys = mockActivationKeys();
ConsumerDTO consumer = TestUtil.createConsumerDTO("sys.example.com", null, null, systemDto);
resource.create(consumer, p, USER, owner.getKey(), createKeysString(keys), true);
}
use of org.candlepin.auth.Principal in project candlepin by candlepin.
the class ConsumerResourceCreationTest method authRequired.
@Test(expected = ForbiddenException.class)
public void authRequired() {
Principal p = new NoAuthPrincipal();
List<String> empty = Collections.emptyList();
createConsumer("sys.example.com", p, empty);
}
use of org.candlepin.auth.Principal in project candlepin by candlepin.
the class ConsumerResourceCreationTest method passIfOnlyOneActivationKeyDoesNotExistForOrg.
@Test
public void passIfOnlyOneActivationKeyDoesNotExistForOrg() {
Principal p = new NoAuthPrincipal();
List<String> keys = mockActivationKeys();
keys.add("NoSuchKey");
ConsumerDTO consumer = TestUtil.createConsumerDTO("sys.example.com", null, null, systemDto);
resource.create(consumer, p, null, owner.getKey(), createKeysString(keys), true);
}
Aggregations