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