use of org.candlepin.dto.api.v1.ConsumerDTO 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.dto.api.v1.ConsumerDTO 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.dto.api.v1.ConsumerDTO 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);
}
use of org.candlepin.dto.api.v1.ConsumerDTO in project candlepin by candlepin.
the class ConsumerResourceIntegrationTest method personalNameOverride.
@Test
public void personalNameOverride() {
ConsumerDTO personal = createConsumerDTO(personTypeDTO, ownerDTO);
personal = consumerResource.create(personal, principal, null, null, null, true);
// Not sure if this should be hard-coded to default
assertEquals(USER_NAME, personal.getName());
}
use of org.candlepin.dto.api.v1.ConsumerDTO in project candlepin by candlepin.
the class ConsumerResourceIntegrationTest method testCreateConsumerVsDefaultServiceLevelForOwner.
@Test
@SuppressWarnings("checkstyle:indentation")
public void testCreateConsumerVsDefaultServiceLevelForOwner() {
ConsumerDTO toSubmit = createConsumerDTO(CONSUMER_NAME, USER_NAME, null, standardSystemTypeDTO);
ConsumerDTO submitted = consumerResource.create(toSubmit, new UserPrincipal(someuser.getUsername(), Arrays.asList(new Permission[] { new OwnerPermission(owner, Access.ALL) }), false), someuser.getUsername(), owner.getKey(), null, true);
assertEquals(DEFAULT_SERVICE_LEVEL, submitted.getServiceLevel());
}
Aggregations