@@ 3351-3405 (lines=55) @@ | ||
3348 | item = res.all()[0] |
|
3349 | eq_(original_id, item.content_id) |
|
3350 | ||
3351 | def test_search_in_description(self): |
|
3352 | # HACK - D.A. - 2015-03-09 |
|
3353 | # This test is based on a bug which does NOT return results found |
|
3354 | # at root of a workspace (eg a folder) |
|
3355 | ||
3356 | uapi = UserApi( |
|
3357 | session=self.session, |
|
3358 | config=self.app_config, |
|
3359 | current_user=None, |
|
3360 | ) |
|
3361 | group_api = GroupApi( |
|
3362 | current_user=None, |
|
3363 | session=self.session, |
|
3364 | config=self.app_config, |
|
3365 | ) |
|
3366 | groups = [group_api.get_one(Group.TIM_USER), |
|
3367 | group_api.get_one(Group.TIM_MANAGER), |
|
3368 | group_api.get_one(Group.TIM_ADMIN)] |
|
3369 | ||
3370 | user = uapi.create_minimal_user(email='this.is@user', |
|
3371 | groups=groups, save_now=True) |
|
3372 | ||
3373 | workspace = WorkspaceApi( |
|
3374 | current_user=user, |
|
3375 | session=self.session, |
|
3376 | config=self.app_config, |
|
3377 | ).create_workspace( |
|
3378 | 'test workspace', |
|
3379 | save_now=True, |
|
3380 | ) |
|
3381 | ||
3382 | api = ContentApi( |
|
3383 | current_user=user, |
|
3384 | session=self.session, |
|
3385 | config=self.app_config, |
|
3386 | ) |
|
3387 | a = api.create(CONTENT_TYPES.Folder.slug, workspace, None, |
|
3388 | 'this is randomized folder', '', True) |
|
3389 | p = api.create(CONTENT_TYPES.Page.slug, workspace, a, |
|
3390 | 'this is dummy label content', '', True) |
|
3391 | ||
3392 | with new_revision( |
|
3393 | tm=transaction.manager, |
|
3394 | session=self.session, |
|
3395 | content=p, |
|
3396 | ): |
|
3397 | p.description = 'This is some amazing test' |
|
3398 | ||
3399 | api.save(p) |
|
3400 | original_id = p.content_id |
|
3401 | ||
3402 | res = api.search(['dummy']) |
|
3403 | eq_(1, len(res.all())) |
|
3404 | item = res.all()[0] |
|
3405 | eq_(original_id, item.content_id) |
|
3406 | ||
3407 | def test_search_in_label_or_description(self): |
|
3408 | # HACK - D.A. - 2015-03-09 |
|
@@ 3296-3349 (lines=54) @@ | ||
3293 | last_actives = api.get_last_active(workspace=workspace2) |
|
3294 | assert len(last_actives) == 0 |
|
3295 | ||
3296 | def test_search_in_label(self): |
|
3297 | # HACK - D.A. - 2015-03-09 |
|
3298 | # This test is based on a bug which does NOT return results found |
|
3299 | # at root of a workspace (eg a folder) |
|
3300 | uapi = UserApi( |
|
3301 | session=self.session, |
|
3302 | config=self.app_config, |
|
3303 | current_user=None, |
|
3304 | ) |
|
3305 | group_api = GroupApi( |
|
3306 | current_user=None, |
|
3307 | session=self.session, |
|
3308 | config=self.app_config, |
|
3309 | ) |
|
3310 | groups = [group_api.get_one(Group.TIM_USER), |
|
3311 | group_api.get_one(Group.TIM_MANAGER), |
|
3312 | group_api.get_one(Group.TIM_ADMIN)] |
|
3313 | ||
3314 | user = uapi.create_minimal_user(email='this.is@user', |
|
3315 | groups=groups, save_now=True) |
|
3316 | ||
3317 | workspace = WorkspaceApi( |
|
3318 | current_user=user, |
|
3319 | session=self.session, |
|
3320 | config=self.app_config, |
|
3321 | ).create_workspace( |
|
3322 | 'test workspace', |
|
3323 | save_now=True |
|
3324 | ) |
|
3325 | ||
3326 | api = ContentApi( |
|
3327 | current_user=user, |
|
3328 | session=self.session, |
|
3329 | config=self.app_config, |
|
3330 | ) |
|
3331 | a = api.create(CONTENT_TYPES.Folder.slug, workspace, None, |
|
3332 | 'this is randomized folder', '', True) |
|
3333 | p = api.create(CONTENT_TYPES.Page.slug, workspace, a, |
|
3334 | 'this is randomized label content', '', True) |
|
3335 | ||
3336 | with new_revision( |
|
3337 | session=self.session, |
|
3338 | tm=transaction.manager, |
|
3339 | content=p, |
|
3340 | ): |
|
3341 | p.description = 'This is some amazing test' |
|
3342 | ||
3343 | api.save(p) |
|
3344 | original_id = p.content_id |
|
3345 | ||
3346 | res = api.search(['randomized']) |
|
3347 | eq_(1, len(res.all())) |
|
3348 | item = res.all()[0] |
|
3349 | eq_(original_id, item.content_id) |
|
3350 | ||
3351 | def test_search_in_description(self): |
|
3352 | # HACK - D.A. - 2015-03-09 |