def ztest_copy_slot(self): view = tile_views.MetaTileManager(self.portal, self.request) self.request.form.update({'metaId': self.slot_id}) new_id = json.loads(view.copy_meta())['newId'] annotations = IAnnotations(self.portal) self.assertTrue(TILE_ANNOTATIONS_KEY_PREFIX + '.' + new_id in annotations) data = annotations[TILE_ANNOTATIONS_KEY_PREFIX + '.' + self.slot_id] self.assertEquals(data['locked']['user'], TEST_USER_ID)
def ztest_cancel_slot_edit(self): view = tile_views.MetaTileManager(self.portal, self.request) self.request.form.update({'metaId': self.slot_id}) annotations = IAnnotations(self.portal) view.copy_meta() view.cancel_copy() self.assertEqual( len([ k for k in annotations.keys() if k.startswith(TILE_ANNOTATIONS_KEY_PREFIX) ]), 3)
def ztest_data_is_updated(self): view = tile_views.MetaTileManager(self.portal, self.request) self.request.form.update({'metaId': self.slot_id}) annotations = IAnnotations(self.portal) view.copy_meta() version_key = view.get_working_copy_key() copy_slot = annotations[TILE_ANNOTATIONS_KEY_PREFIX + '.' + self.slot_id + '-' + version_key] # noqa tile = copy_slot['tiles'][0] tile_id = tile['id'] tile_data = annotations[TILE_ANNOTATIONS_KEY_PREFIX + '.' + tile_id] tile_data['foo'] = 'bozo' view.save_copy() tile_data = annotations[TILE_ANNOTATIONS_KEY_PREFIX + '.' + tile_id.replace('-' + version_key, '')] # noqa self.assertEquals(tile_data['foo'], 'bozo')
def ztest_tile_is_deleted(self): view = tile_views.MetaTileManager(self.portal, self.request) self.request.form.update({'metaId': self.slot_id}) annotations = IAnnotations(self.portal) view.copy_meta() version_key = view.get_working_copy_key() copy_slot = annotations[TILE_ANNOTATIONS_KEY_PREFIX + '.' + self.slot_id + '-' + version_key] # noqa tile = copy_slot['tiles'][0] copy_slot['tiles'].remove(tile) tile_id = tile['id'] del annotations[TILE_ANNOTATIONS_KEY_PREFIX + '.' + tile_id] view.save_copy() self.assertEqual( len([ k for k in annotations.keys() if k.startswith(TILE_ANNOTATIONS_KEY_PREFIX) ]), 2)