use of org.craftercms.profile.api.Tenant in project profile by craftercms.
the class TenantServiceImplTest method testRemoveAttributeDefinitions.
@Test
public void testRemoveAttributeDefinitions() throws Exception {
Tenant expected = getTenant1();
expected.getAttributeDefinitions().clear();
Map<String, Object> attrNameCondition = Collections.singletonMap("$in", Collections.singletonList(ATTRIB1_NAME));
Map<String, Object> expectedPullParams = new HashMap<>();
expectedPullParams.put("attributeDefinitions", Collections.singletonMap("name", attrNameCondition));
Tenant actual = tenantService.removeAttributeDefinitions(TENANT1_NAME, Collections.singletonList(ATTRIB1_NAME));
assertEqualTenants(expected, actual);
verify(tenantRepository).findByName(TENANT1_NAME);
verify(tenantRepository).update(TENANT1_ID.toString(), "{$pull: #}", false, false, expectedPullParams);
}
Aggregations