use of org.candlepin.util.ContentOverrideValidator in project candlepin by candlepin.
the class ConsumerContentOverrideResourceTest method setUp.
@Before
public void setUp() {
ConsumerType ctype = new ConsumerType("test-consumer-type");
ctype.setId("test-ctype");
consumer = new Consumer("test-consumer", "test-user", new Owner("Test Owner"), ctype);
MultivaluedMap<String, String> mvm = new MultivaluedMapImpl<>();
mvm.add("consumer_uuid", consumer.getUuid());
context = mock(UriInfo.class);
when(context.getPathParameters()).thenReturn(mvm);
when(consumerCurator.verifyAndLookupConsumer(eq(consumer.getUuid()))).thenReturn(consumer);
when(overrideRules.canOverrideForConsumer(any(String.class))).thenReturn(true);
i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK);
contentOverrideValidator = new ContentOverrideValidator(i18n, overrideRules);
resource = new ConsumerContentOverrideResource(consumerContentOverrideCurator, consumerCurator, contentOverrideValidator, i18n);
when(principal.canAccess(any(Object.class), any(SubResource.class), any(Access.class))).thenReturn(true);
}
Aggregations