|
@@ -2122,6 +2122,81 @@ class TestContentApi(DefaultTest):
|
2122
|
2122
|
# folder subcontent modification does not change folder order
|
2123
|
2123
|
assert last_actives[6] == main_folder
|
2124
|
2124
|
|
|
2125
|
+ def test_unit__get_last_active__ok__workspace_filter_workspace_content_ids(self):
|
|
2126
|
+ uapi = UserApi(
|
|
2127
|
+ session=self.session,
|
|
2128
|
+ config=self.app_config,
|
|
2129
|
+ current_user=None,
|
|
2130
|
+ )
|
|
2131
|
+ group_api = GroupApi(
|
|
2132
|
+ current_user=None,
|
|
2133
|
+ session=self.session,
|
|
2134
|
+ config=self.app_config,
|
|
2135
|
+ )
|
|
2136
|
+ groups = [group_api.get_one(Group.TIM_USER),
|
|
2137
|
+ group_api.get_one(Group.TIM_MANAGER),
|
|
2138
|
+ group_api.get_one(Group.TIM_ADMIN)]
|
|
2139
|
+
|
|
2140
|
+ user = uapi.create_minimal_user(email='this.is@user',
|
|
2141
|
+ groups=groups, save_now=True)
|
|
2142
|
+ workspace = WorkspaceApi(
|
|
2143
|
+ current_user=user,
|
|
2144
|
+ session=self.session,
|
|
2145
|
+ config=self.app_config,
|
|
2146
|
+ ).create_workspace(
|
|
2147
|
+ 'test workspace',
|
|
2148
|
+ save_now=True
|
|
2149
|
+ )
|
|
2150
|
+
|
|
2151
|
+ api = ContentApi(
|
|
2152
|
+ current_user=user,
|
|
2153
|
+ session=self.session,
|
|
2154
|
+ config=self.app_config,
|
|
2155
|
+ )
|
|
2156
|
+ main_folder = api.create(ContentType.Folder, workspace, None, 'this is randomized folder', '', True) # nopep8
|
|
2157
|
+ # creation order test
|
|
2158
|
+ firstly_created = api.create(ContentType.Page, workspace, main_folder, 'creation_order_test', '', True) # nopep8
|
|
2159
|
+ secondly_created = api.create(ContentType.Page, workspace, main_folder, 'another creation_order_test', '', True) # nopep8
|
|
2160
|
+ # update order test
|
|
2161
|
+ firstly_created_but_recently_updated = api.create(ContentType.Page, workspace, main_folder, 'update_order_test', '', True) # nopep8
|
|
2162
|
+ secondly_created_but_not_updated = api.create(ContentType.Page, workspace, main_folder, 'another update_order_test', '', True) # nopep8
|
|
2163
|
+ with new_revision(
|
|
2164
|
+ session=self.session,
|
|
2165
|
+ tm=transaction.manager,
|
|
2166
|
+ content=firstly_created_but_recently_updated,
|
|
2167
|
+ ):
|
|
2168
|
+ firstly_created_but_recently_updated.description = 'Just an update'
|
|
2169
|
+ api.save(firstly_created_but_recently_updated)
|
|
2170
|
+ # comment change order
|
|
2171
|
+ firstly_created_but_recently_commented = api.create(ContentType.Page, workspace, main_folder, 'this is randomized label content', '', True) # nopep8
|
|
2172
|
+ secondly_created_but_not_commented = api.create(ContentType.Page, workspace, main_folder, 'this is another randomized label content', '', True) # nopep8
|
|
2173
|
+ comments = api.create_comment(workspace, firstly_created_but_recently_commented, 'juste a super comment', True) # nopep8
|
|
2174
|
+
|
|
2175
|
+ selected_contents = [
|
|
2176
|
+ firstly_created_but_recently_commented,
|
|
2177
|
+ firstly_created_but_recently_updated,
|
|
2178
|
+ firstly_created,
|
|
2179
|
+ main_folder,
|
|
2180
|
+ ]
|
|
2181
|
+ content_ids = [content.content_id for content in selected_contents]
|
|
2182
|
+ last_actives = api.get_last_active(
|
|
2183
|
+ workspace=workspace,
|
|
2184
|
+ content_ids=content_ids,
|
|
2185
|
+ )
|
|
2186
|
+ assert len(last_actives) == 4
|
|
2187
|
+ # comment is newest than page2
|
|
2188
|
+ assert last_actives[0] == firstly_created_but_recently_commented
|
|
2189
|
+ assert secondly_created_but_not_commented not in last_actives
|
|
2190
|
+ # last updated content is newer than other one despite creation
|
|
2191
|
+ # of the other is more recent
|
|
2192
|
+ assert last_actives[1] == firstly_created_but_recently_updated
|
|
2193
|
+ assert secondly_created_but_not_updated not in last_actives
|
|
2194
|
+ # creation order is inverted here as last created is last active
|
|
2195
|
+ assert secondly_created not in last_actives
|
|
2196
|
+ assert last_actives[2] == firstly_created
|
|
2197
|
+ # folder subcontent modification does not change folder order
|
|
2198
|
+ assert last_actives[3] == main_folder
|
|
2199
|
+
|
2125
|
2200
|
def test_unit__get_last_active__ok__workspace_filter_workspace_limit_2_multiples_times(self): # nopep8
|
2126
|
2201
|
uapi = UserApi(
|
2127
|
2202
|
session=self.session,
|