test_workspaces.py 45KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181
  1. # -*- coding: utf-8 -*-
  2. """
  3. Tests for /api/v2/workspaces subpath endpoints.
  4. """
  5. from tracim.tests import FunctionalTest
  6. from tracim.fixtures.content import Content as ContentFixtures
  7. from tracim.fixtures.users_and_groups import Base as BaseFixture
  8. class TestWorkspaceEndpoint(FunctionalTest):
  9. """
  10. Tests for /api/v2/workspaces/{workspace_id} endpoint
  11. """
  12. fixtures = [BaseFixture, ContentFixtures]
  13. def test_api__get_workspace__ok_200__nominal_case(self) -> None:
  14. """
  15. Check obtain workspace reachable for user.
  16. """
  17. self.testapp.authorization = (
  18. 'Basic',
  19. (
  20. 'admin@admin.admin',
  21. 'admin@admin.admin'
  22. )
  23. )
  24. res = self.testapp.get('/api/v2/workspaces/1', status=200)
  25. workspace = res.json_body
  26. assert workspace['id'] == 1
  27. assert workspace['slug'] == 'business'
  28. assert workspace['label'] == 'Business'
  29. assert workspace['description'] == 'All importants documents'
  30. assert len(workspace['sidebar_entries']) == 7
  31. sidebar_entry = workspace['sidebar_entries'][0]
  32. assert sidebar_entry['slug'] == 'dashboard'
  33. assert sidebar_entry['label'] == 'Dashboard'
  34. assert sidebar_entry['route'] == '/#/workspaces/1/dashboard' # nopep8
  35. assert sidebar_entry['hexcolor'] == "#252525"
  36. assert sidebar_entry['fa_icon'] == ""
  37. sidebar_entry = workspace['sidebar_entries'][1]
  38. assert sidebar_entry['slug'] == 'contents/all'
  39. assert sidebar_entry['label'] == 'All Contents'
  40. assert sidebar_entry['route'] == "/#/workspaces/1/contents" # nopep8
  41. assert sidebar_entry['hexcolor'] == "#fdfdfd"
  42. assert sidebar_entry['fa_icon'] == ""
  43. sidebar_entry = workspace['sidebar_entries'][2]
  44. assert sidebar_entry['slug'] == 'contents/htmlpage'
  45. assert sidebar_entry['label'] == 'Text Documents'
  46. assert sidebar_entry['route'] == '/#/workspaces/1/contents?type=htmlpage' # nopep8
  47. assert sidebar_entry['hexcolor'] == "#3f52e3"
  48. assert sidebar_entry['fa_icon'] == "file-text-o"
  49. sidebar_entry = workspace['sidebar_entries'][3]
  50. assert sidebar_entry['slug'] == 'contents/markdownpluspage'
  51. assert sidebar_entry['label'] == 'Markdown Plus Documents'
  52. assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=markdownpluspage" # nopep8
  53. assert sidebar_entry['hexcolor'] == "#f12d2d"
  54. assert sidebar_entry['fa_icon'] == "file-code"
  55. sidebar_entry = workspace['sidebar_entries'][4]
  56. assert sidebar_entry['slug'] == 'contents/files'
  57. assert sidebar_entry['label'] == 'Files'
  58. assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=file" # nopep8
  59. assert sidebar_entry['hexcolor'] == "#FF9900"
  60. assert sidebar_entry['fa_icon'] == "paperclip"
  61. sidebar_entry = workspace['sidebar_entries'][5]
  62. assert sidebar_entry['slug'] == 'contents/threads'
  63. assert sidebar_entry['label'] == 'Threads'
  64. assert sidebar_entry['route'] == "/#/workspaces/1/contents?type=thread" # nopep8
  65. assert sidebar_entry['hexcolor'] == "#ad4cf9"
  66. assert sidebar_entry['fa_icon'] == "comments-o"
  67. sidebar_entry = workspace['sidebar_entries'][6]
  68. assert sidebar_entry['slug'] == 'calendar'
  69. assert sidebar_entry['label'] == 'Calendar'
  70. assert sidebar_entry['route'] == "/#/workspaces/1/calendar" # nopep8
  71. assert sidebar_entry['hexcolor'] == "#757575"
  72. assert sidebar_entry['fa_icon'] == "calendar-alt"
  73. def test_api__get_workspace__err_403__unallowed_user(self) -> None:
  74. """
  75. Check obtain workspace unreachable for user
  76. """
  77. self.testapp.authorization = (
  78. 'Basic',
  79. (
  80. 'lawrence-not-real-email@fsf.local',
  81. 'foobarbaz'
  82. )
  83. )
  84. res = self.testapp.get('/api/v2/workspaces/1', status=403)
  85. assert isinstance(res.json, dict)
  86. assert 'code' in res.json.keys()
  87. assert 'message' in res.json.keys()
  88. assert 'details' in res.json.keys()
  89. def test_api__get_workspace__err_401__unregistered_user(self) -> None:
  90. """
  91. Check obtain workspace without registered user.
  92. """
  93. self.testapp.authorization = (
  94. 'Basic',
  95. (
  96. 'john@doe.doe',
  97. 'lapin'
  98. )
  99. )
  100. res = self.testapp.get('/api/v2/workspaces/1', status=401)
  101. assert isinstance(res.json, dict)
  102. assert 'code' in res.json.keys()
  103. assert 'message' in res.json.keys()
  104. assert 'details' in res.json.keys()
  105. def test_api__get_workspace__err_403__workspace_does_not_exist(self) -> None: # nopep8
  106. """
  107. Check obtain workspace who does not exist with an existing user.
  108. """
  109. self.testapp.authorization = (
  110. 'Basic',
  111. (
  112. 'admin@admin.admin',
  113. 'admin@admin.admin'
  114. )
  115. )
  116. res = self.testapp.get('/api/v2/workspaces/5', status=403)
  117. assert isinstance(res.json, dict)
  118. assert 'code' in res.json.keys()
  119. assert 'message' in res.json.keys()
  120. assert 'details' in res.json.keys()
  121. class TestWorkspaceMembersEndpoint(FunctionalTest):
  122. """
  123. Tests for /api/v2/workspaces/{workspace_id}/members endpoint
  124. """
  125. fixtures = [BaseFixture, ContentFixtures]
  126. def test_api__get_workspace_members__ok_200__nominal_case(self):
  127. """
  128. Check obtain workspace members list with a reachable workspace for user
  129. """
  130. self.testapp.authorization = (
  131. 'Basic',
  132. (
  133. 'admin@admin.admin',
  134. 'admin@admin.admin'
  135. )
  136. )
  137. res = self.testapp.get('/api/v2/workspaces/1/members', status=200).json_body # nopep8
  138. assert len(res) == 1
  139. user_role = res[0]
  140. assert user_role['role_slug'] == 'workspace-manager'
  141. assert user_role['user_id'] == 1
  142. assert user_role['workspace_id'] == 1
  143. assert user_role['user']['display_name'] == 'Global manager'
  144. # TODO - G.M - 24-05-2018 - [Avatar] Replace
  145. # by correct value when avatar feature will be enabled
  146. assert user_role['user']['avatar_url'] is None
  147. def test_api__get_workspace_members__err_403__unallowed_user(self):
  148. """
  149. Check obtain workspace members list with an unreachable workspace for
  150. user
  151. """
  152. self.testapp.authorization = (
  153. 'Basic',
  154. (
  155. 'lawrence-not-real-email@fsf.local',
  156. 'foobarbaz'
  157. )
  158. )
  159. res = self.testapp.get('/api/v2/workspaces/3/members', status=403)
  160. assert isinstance(res.json, dict)
  161. assert 'code' in res.json.keys()
  162. assert 'message' in res.json.keys()
  163. assert 'details' in res.json.keys()
  164. def test_api__get_workspace_members__err_401__unregistered_user(self):
  165. """
  166. Check obtain workspace members list with an unregistered user
  167. """
  168. self.testapp.authorization = (
  169. 'Basic',
  170. (
  171. 'john@doe.doe',
  172. 'lapin'
  173. )
  174. )
  175. res = self.testapp.get('/api/v2/workspaces/1/members', status=401)
  176. assert isinstance(res.json, dict)
  177. assert 'code' in res.json.keys()
  178. assert 'message' in res.json.keys()
  179. assert 'details' in res.json.keys()
  180. def test_api__get_workspace_members__err_403__workspace_does_not_exist(self): # nopep8
  181. """
  182. Check obtain workspace members list with an existing user but
  183. an unexisting workspace
  184. """
  185. self.testapp.authorization = (
  186. 'Basic',
  187. (
  188. 'admin@admin.admin',
  189. 'admin@admin.admin'
  190. )
  191. )
  192. res = self.testapp.get('/api/v2/workspaces/5/members', status=403)
  193. assert isinstance(res.json, dict)
  194. assert 'code' in res.json.keys()
  195. assert 'message' in res.json.keys()
  196. assert 'details' in res.json.keys()
  197. class TestWorkspaceContents(FunctionalTest):
  198. """
  199. Tests for /api/v2/workspaces/{workspace_id}/contents endpoint
  200. """
  201. fixtures = [BaseFixture, ContentFixtures]
  202. def test_api__get_workspace_content__ok_200__get_default(self):
  203. """
  204. Check obtain workspace contents with defaults filters
  205. """
  206. self.testapp.authorization = (
  207. 'Basic',
  208. (
  209. 'admin@admin.admin',
  210. 'admin@admin.admin'
  211. )
  212. )
  213. res = self.testapp.get('/api/v2/workspaces/1/contents', status=200).json_body # nopep8
  214. # TODO - G.M - 30-05-2018 - Check this test
  215. assert len(res) == 3
  216. content = res[0]
  217. assert content['id'] == 1
  218. assert content['is_archived'] is False
  219. assert content['is_deleted'] is False
  220. assert content['label'] == 'Tools'
  221. assert content['parent_id'] is None
  222. assert content['show_in_ui'] is True
  223. assert content['slug'] == 'tools'
  224. assert content['status_slug'] == 'open'
  225. assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
  226. assert content['workspace_id'] == 1
  227. content = res[1]
  228. assert content['id'] == 2
  229. assert content['is_archived'] is False
  230. assert content['is_deleted'] is False
  231. assert content['label'] == 'Menus'
  232. assert content['parent_id'] is None
  233. assert content['show_in_ui'] is True
  234. assert content['slug'] == 'menus'
  235. assert content['status_slug'] == 'open'
  236. assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
  237. assert content['workspace_id'] == 1
  238. content = res[2]
  239. assert content['id'] == 11
  240. assert content['is_archived'] is False
  241. assert content['is_deleted'] is False
  242. assert content['label'] == 'Current Menu'
  243. assert content['parent_id'] == 2
  244. assert content['show_in_ui'] is True
  245. assert content['slug'] == 'current-menu'
  246. assert content['status_slug'] == 'open'
  247. assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
  248. assert content['workspace_id'] == 1
  249. # Root related
  250. def test_api__get_workspace_content__ok_200__get_all_root_content(self):
  251. """
  252. Check obtain workspace all root contents
  253. """
  254. params = {
  255. 'parent_id': 0,
  256. 'show_archived': 1,
  257. 'show_deleted': 1,
  258. 'show_active': 1,
  259. }
  260. self.testapp.authorization = (
  261. 'Basic',
  262. (
  263. 'bob@fsf.local',
  264. 'foobarbaz'
  265. )
  266. )
  267. res = self.testapp.get(
  268. '/api/v2/workspaces/3/contents',
  269. status=200,
  270. params=params,
  271. ).json_body # nopep8
  272. # TODO - G.M - 30-05-2018 - Check this test
  273. assert len(res) == 4
  274. content = res[1]
  275. assert content['content_type_slug'] == 'page'
  276. assert content['id'] == 15
  277. assert content['is_archived'] is False
  278. assert content['is_deleted'] is False
  279. assert content['label'] == 'New Fruit Salad'
  280. assert content['parent_id'] is None
  281. assert content['show_in_ui'] is True
  282. assert content['slug'] == 'new-fruit-salad'
  283. assert content['status_slug'] == 'open'
  284. assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
  285. assert content['workspace_id'] == 3
  286. content = res[2]
  287. assert content['content_type_slug'] == 'page'
  288. assert content['id'] == 16
  289. assert content['is_archived'] is True
  290. assert content['is_deleted'] is False
  291. assert content['label'].startswith('Fruit Salad')
  292. assert content['parent_id'] is None
  293. assert content['show_in_ui'] is True
  294. assert content['slug'].startswith('fruit-salad')
  295. assert content['status_slug'] == 'open'
  296. assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
  297. assert content['workspace_id'] == 3
  298. content = res[3]
  299. assert content['content_type_slug'] == 'page'
  300. assert content['id'] == 17
  301. assert content['is_archived'] is False
  302. assert content['is_deleted'] is True
  303. assert content['label'].startswith('Bad Fruit Salad')
  304. assert content['parent_id'] is None
  305. assert content['show_in_ui'] is True
  306. assert content['slug'].startswith('bad-fruit-salad')
  307. assert content['status_slug'] == 'open'
  308. assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
  309. assert content['workspace_id'] == 3
  310. def test_api__get_workspace_content__ok_200__get_only_active_root_content(self): # nopep8
  311. """
  312. Check obtain workspace root active contents
  313. """
  314. params = {
  315. 'parent_id': 0,
  316. 'show_archived': 0,
  317. 'show_deleted': 0,
  318. 'show_active': 1,
  319. }
  320. self.testapp.authorization = (
  321. 'Basic',
  322. (
  323. 'bob@fsf.local',
  324. 'foobarbaz'
  325. )
  326. )
  327. res = self.testapp.get(
  328. '/api/v2/workspaces/3/contents',
  329. status=200,
  330. params=params,
  331. ).json_body # nopep8
  332. # TODO - G.M - 30-05-2018 - Check this test
  333. assert len(res) == 2
  334. content = res[1]
  335. assert content['content_type_slug'] == 'page'
  336. assert content['id'] == 15
  337. assert content['is_archived'] is False
  338. assert content['is_deleted'] is False
  339. assert content['label'] == 'New Fruit Salad'
  340. assert content['parent_id'] is None
  341. assert content['show_in_ui'] is True
  342. assert content['slug'] == 'new-fruit-salad'
  343. assert content['status_slug'] == 'open'
  344. assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
  345. assert content['workspace_id'] == 3
  346. def test_api__get_workspace_content__ok_200__get_only_archived_root_content(self): # nopep8
  347. """
  348. Check obtain workspace root archived contents
  349. """
  350. params = {
  351. 'parent_id': 0,
  352. 'show_archived': 1,
  353. 'show_deleted': 0,
  354. 'show_active': 0,
  355. }
  356. self.testapp.authorization = (
  357. 'Basic',
  358. (
  359. 'bob@fsf.local',
  360. 'foobarbaz'
  361. )
  362. )
  363. res = self.testapp.get(
  364. '/api/v2/workspaces/3/contents',
  365. status=200,
  366. params=params,
  367. ).json_body # nopep8
  368. assert len(res) == 1
  369. content = res[0]
  370. assert content['content_type_slug'] == 'page'
  371. assert content['id'] == 16
  372. assert content['is_archived'] is True
  373. assert content['is_deleted'] is False
  374. assert content['label'].startswith('Fruit Salad')
  375. assert content['parent_id'] is None
  376. assert content['show_in_ui'] is True
  377. assert content['slug'].startswith('fruit-salad')
  378. assert content['status_slug'] == 'open'
  379. assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
  380. assert content['workspace_id'] == 3
  381. def test_api__get_workspace_content__ok_200__get_only_deleted_root_content(self): # nopep8
  382. """
  383. Check obtain workspace root deleted contents
  384. """
  385. params = {
  386. 'parent_id': 0,
  387. 'show_archived': 0,
  388. 'show_deleted': 1,
  389. 'show_active': 0,
  390. }
  391. self.testapp.authorization = (
  392. 'Basic',
  393. (
  394. 'bob@fsf.local',
  395. 'foobarbaz'
  396. )
  397. )
  398. res = self.testapp.get(
  399. '/api/v2/workspaces/3/contents',
  400. status=200,
  401. params=params,
  402. ).json_body # nopep8
  403. # TODO - G.M - 30-05-2018 - Check this test
  404. assert len(res) == 1
  405. content = res[0]
  406. assert content['content_type_slug'] == 'page'
  407. assert content['id'] == 17
  408. assert content['is_archived'] is False
  409. assert content['is_deleted'] is True
  410. assert content['label'].startswith('Bad Fruit Salad')
  411. assert content['parent_id'] is None
  412. assert content['show_in_ui'] is True
  413. assert content['slug'].startswith('bad-fruit-salad')
  414. assert content['status_slug'] == 'open'
  415. assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
  416. assert content['workspace_id'] == 3
  417. def test_api__get_workspace_content__ok_200__get_nothing_root_content(self):
  418. """
  419. Check obtain workspace root content who does not match any type
  420. (archived, deleted, active) result should be empty list.
  421. """
  422. params = {
  423. 'parent_id': 0,
  424. 'show_archived': 0,
  425. 'show_deleted': 0,
  426. 'show_active': 0,
  427. }
  428. self.testapp.authorization = (
  429. 'Basic',
  430. (
  431. 'bob@fsf.local',
  432. 'foobarbaz'
  433. )
  434. )
  435. res = self.testapp.get(
  436. '/api/v2/workspaces/3/contents',
  437. status=200,
  438. params=params,
  439. ).json_body # nopep8
  440. # TODO - G.M - 30-05-2018 - Check this test
  441. assert res == []
  442. # Folder related
  443. def test_api__get_workspace_content__ok_200__get_all_folder_content(self):
  444. """
  445. Check obtain workspace folder all contents
  446. """
  447. params = {
  448. 'parent_id': 10, # TODO - G.M - 30-05-2018 - Find a real id
  449. 'show_archived': 1,
  450. 'show_deleted': 1,
  451. 'show_active': 1,
  452. }
  453. self.testapp.authorization = (
  454. 'Basic',
  455. (
  456. 'admin@admin.admin',
  457. 'admin@admin.admin'
  458. )
  459. )
  460. res = self.testapp.get(
  461. '/api/v2/workspaces/2/contents',
  462. status=200,
  463. params=params,
  464. ).json_body # nopep8
  465. assert len(res) == 3
  466. content = res[0]
  467. assert content['content_type_slug'] == 'page'
  468. assert content['id'] == 12
  469. assert content['is_archived'] is False
  470. assert content['is_deleted'] is False
  471. assert content['label'] == 'New Fruit Salad'
  472. assert content['parent_id'] == 10
  473. assert content['show_in_ui'] is True
  474. assert content['slug'] == 'new-fruit-salad'
  475. assert content['status_slug'] == 'open'
  476. assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
  477. assert content['workspace_id'] == 2
  478. content = res[1]
  479. assert content['content_type_slug'] == 'page'
  480. assert content['id'] == 13
  481. assert content['is_archived'] is True
  482. assert content['is_deleted'] is False
  483. assert content['label'].startswith('Fruit Salad')
  484. assert content['parent_id'] == 10
  485. assert content['show_in_ui'] is True
  486. assert content['slug'].startswith('fruit-salad')
  487. assert content['status_slug'] == 'open'
  488. assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
  489. assert content['workspace_id'] == 2
  490. content = res[2]
  491. assert content['content_type_slug'] == 'page'
  492. assert content['id'] == 14
  493. assert content['is_archived'] is False
  494. assert content['is_deleted'] is True
  495. assert content['label'].startswith('Bad Fruit Salad')
  496. assert content['parent_id'] == 10
  497. assert content['show_in_ui'] is True
  498. assert content['slug'].startswith('bad-fruit-salad')
  499. assert content['status_slug'] == 'open'
  500. assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
  501. assert content['workspace_id'] == 2
  502. def test_api__get_workspace_content__ok_200__get_only_active_folder_content(self): # nopep8
  503. """
  504. Check obtain workspace folder active contents
  505. """
  506. params = {
  507. 'parent_id': 10,
  508. 'show_archived': 0,
  509. 'show_deleted': 0,
  510. 'show_active': 1,
  511. }
  512. self.testapp.authorization = (
  513. 'Basic',
  514. (
  515. 'admin@admin.admin',
  516. 'admin@admin.admin'
  517. )
  518. )
  519. res = self.testapp.get(
  520. '/api/v2/workspaces/2/contents',
  521. status=200,
  522. params=params,
  523. ).json_body # nopep8
  524. assert len(res) == 1
  525. content = res[0]
  526. assert content['content_type_slug']
  527. assert content['id'] == 12
  528. assert content['is_archived'] is False
  529. assert content['is_deleted'] is False
  530. assert content['label'] == 'New Fruit Salad'
  531. assert content['parent_id'] == 10
  532. assert content['show_in_ui'] is True
  533. assert content['slug'] == 'new-fruit-salad'
  534. assert content['status_slug'] == 'open'
  535. assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
  536. assert content['workspace_id'] == 2
  537. def test_api__get_workspace_content__ok_200__get_only_archived_folder_content(self): # nopep8
  538. """
  539. Check obtain workspace folder archived contents
  540. """
  541. params = {
  542. 'parent_id': 10,
  543. 'show_archived': 1,
  544. 'show_deleted': 0,
  545. 'show_active': 0,
  546. }
  547. self.testapp.authorization = (
  548. 'Basic',
  549. (
  550. 'admin@admin.admin',
  551. 'admin@admin.admin'
  552. )
  553. )
  554. res = self.testapp.get(
  555. '/api/v2/workspaces/2/contents',
  556. status=200,
  557. params=params,
  558. ).json_body # nopep8
  559. assert len(res) == 1
  560. content = res[0]
  561. assert content['content_type_slug'] == 'page'
  562. assert content['id'] == 13
  563. assert content['is_archived'] is True
  564. assert content['is_deleted'] is False
  565. assert content['label'].startswith('Fruit Salad')
  566. assert content['parent_id'] == 10
  567. assert content['show_in_ui'] is True
  568. assert content['slug'].startswith('fruit-salad')
  569. assert content['status_slug'] == 'open'
  570. assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
  571. assert content['workspace_id'] == 2
  572. def test_api__get_workspace_content__ok_200__get_only_deleted_folder_content(self): # nopep8
  573. """
  574. Check obtain workspace folder deleted contents
  575. """
  576. params = {
  577. 'parent_id': 10,
  578. 'show_archived': 0,
  579. 'show_deleted': 1,
  580. 'show_active': 0,
  581. }
  582. self.testapp.authorization = (
  583. 'Basic',
  584. (
  585. 'admin@admin.admin',
  586. 'admin@admin.admin'
  587. )
  588. )
  589. res = self.testapp.get(
  590. '/api/v2/workspaces/2/contents',
  591. status=200,
  592. params=params,
  593. ).json_body # nopep8
  594. assert len(res) == 1
  595. content = res[0]
  596. assert content['content_type_slug'] == 'page'
  597. assert content['id'] == 14
  598. assert content['is_archived'] is False
  599. assert content['is_deleted'] is True
  600. assert content['label'].startswith('Bad Fruit Salad')
  601. assert content['parent_id'] == 10
  602. assert content['show_in_ui'] is True
  603. assert content['slug'].startswith('bad-fruit-salad')
  604. assert content['status_slug'] == 'open'
  605. assert set(content['sub_content_type_slug']) == {'thread', 'page', 'folder', 'file'} # nopep8
  606. assert content['workspace_id'] == 2
  607. def test_api__get_workspace_content__ok_200__get_nothing_folder_content(self): # nopep8
  608. """
  609. Check obtain workspace folder content who does not match any type
  610. (archived, deleted, active) result should be empty list.
  611. """
  612. params = {
  613. 'parent_id': 10,
  614. 'show_archived': 0,
  615. 'show_deleted': 0,
  616. 'show_active': 0,
  617. }
  618. self.testapp.authorization = (
  619. 'Basic',
  620. (
  621. 'admin@admin.admin',
  622. 'admin@admin.admin'
  623. )
  624. )
  625. res = self.testapp.get(
  626. '/api/v2/workspaces/2/contents',
  627. status=200,
  628. params=params,
  629. ).json_body # nopep8
  630. # TODO - G.M - 30-05-2018 - Check this test
  631. assert res == []
  632. # Error case
  633. def test_api__get_workspace_content__err_403__unallowed_user(self):
  634. """
  635. Check obtain workspace content list with an unreachable workspace for
  636. user
  637. """
  638. self.testapp.authorization = (
  639. 'Basic',
  640. (
  641. 'lawrence-not-real-email@fsf.local',
  642. 'foobarbaz'
  643. )
  644. )
  645. res = self.testapp.get('/api/v2/workspaces/3/contents', status=403)
  646. assert isinstance(res.json, dict)
  647. assert 'code' in res.json.keys()
  648. assert 'message' in res.json.keys()
  649. assert 'details' in res.json.keys()
  650. def test_api__get_workspace_content__err_401__unregistered_user(self):
  651. """
  652. Check obtain workspace content list with an unregistered user
  653. """
  654. self.testapp.authorization = (
  655. 'Basic',
  656. (
  657. 'john@doe.doe',
  658. 'lapin'
  659. )
  660. )
  661. res = self.testapp.get('/api/v2/workspaces/1/contents', status=401)
  662. assert isinstance(res.json, dict)
  663. assert 'code' in res.json.keys()
  664. assert 'message' in res.json.keys()
  665. assert 'details' in res.json.keys()
  666. def test_api__get_workspace_content__err_403__workspace_does_not_exist(self): # nopep8
  667. """
  668. Check obtain workspace contents list with an existing user but
  669. an unexisting workspace
  670. """
  671. self.testapp.authorization = (
  672. 'Basic',
  673. (
  674. 'admin@admin.admin',
  675. 'admin@admin.admin'
  676. )
  677. )
  678. res = self.testapp.get('/api/v2/workspaces/5/contents', status=403)
  679. assert isinstance(res.json, dict)
  680. assert 'code' in res.json.keys()
  681. assert 'message' in res.json.keys()
  682. assert 'details' in res.json.keys()
  683. def test_api__post_content_create_generic_content__ok_200__nominal_case(self) -> None: # nopep8
  684. """
  685. Create generic content
  686. """
  687. self.testapp.authorization = (
  688. 'Basic',
  689. (
  690. 'admin@admin.admin',
  691. 'admin@admin.admin'
  692. )
  693. )
  694. params = {
  695. 'label': 'GenericCreatedContent',
  696. 'content_type_slug': 'markdownpage',
  697. }
  698. res = self.testapp.post_json(
  699. '/api/v2/workspaces/1/contents',
  700. params=params,
  701. status=200
  702. )
  703. assert res
  704. assert res.json_body
  705. assert res.json_body['status_slug'] == 'open'
  706. assert res.json_body['id']
  707. assert res.json_body['content_type_slug'] == 'markdownpage'
  708. assert res.json_body['is_archived'] is False
  709. assert res.json_body['is_deleted'] is False
  710. assert res.json_body['workspace_id'] == 1
  711. assert res.json_body['slug'] == 'genericcreatedcontent'
  712. assert res.json_body['parent_id'] is None
  713. assert res.json_body['show_in_ui'] is True
  714. assert res.json_body['sub_content_type_slug']
  715. params_active = {
  716. 'parent_id': 0,
  717. 'show_archived': 0,
  718. 'show_deleted': 0,
  719. 'show_active': 1,
  720. }
  721. # INFO - G.M - 2018-06-165 - Verify if new content is correctly created
  722. active_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_active, status=200).json_body # nopep8
  723. assert res.json_body in active_contents
  724. def test_api_put_move_content__ok_200__nominal_case(self):
  725. """
  726. Move content
  727. move Apple_Pie (content_id: 8)
  728. from Desserts folder(content_id: 3) to Salads subfolder (content_id: 4)
  729. of workspace Recipes.
  730. """
  731. self.testapp.authorization = (
  732. 'Basic',
  733. (
  734. 'admin@admin.admin',
  735. 'admin@admin.admin'
  736. )
  737. )
  738. params = {
  739. 'new_parent_id': '4', # Salads
  740. }
  741. params_folder1 = {
  742. 'parent_id': 3,
  743. 'show_archived': 0,
  744. 'show_deleted': 0,
  745. 'show_active': 1,
  746. }
  747. params_folder2 = {
  748. 'parent_id': 4,
  749. 'show_archived': 0,
  750. 'show_deleted': 0,
  751. 'show_active': 1,
  752. }
  753. folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
  754. folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
  755. assert [content for content in folder1_contents if content['id'] == 8] # nopep8
  756. assert not [content for content in folder2_contents if content['id'] == 8] # nopep8
  757. # TODO - G.M - 2018-06-163 - Check content
  758. res = self.testapp.put_json(
  759. '/api/v2/workspaces/2/contents/8/move',
  760. params=params,
  761. status=200
  762. )
  763. new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
  764. new_folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
  765. assert not [content for content in new_folder1_contents if content['id'] == 8] # nopep8
  766. assert [content for content in new_folder2_contents if content['id'] == 8] # nopep8
  767. def test_api_put_move_content__ok_200__to_root(self):
  768. """
  769. Move content
  770. move Apple_Pie (content_id: 8)
  771. from Desserts folder(content_id: 3) to root (content_id: 0)
  772. of workspace Recipes.
  773. """
  774. self.testapp.authorization = (
  775. 'Basic',
  776. (
  777. 'admin@admin.admin',
  778. 'admin@admin.admin'
  779. )
  780. )
  781. params = {
  782. 'new_parent_id': '0', # root
  783. }
  784. params_folder1 = {
  785. 'parent_id': 3,
  786. 'show_archived': 0,
  787. 'show_deleted': 0,
  788. 'show_active': 1,
  789. }
  790. params_folder2 = {
  791. 'parent_id': 0,
  792. 'show_archived': 0,
  793. 'show_deleted': 0,
  794. 'show_active': 1,
  795. }
  796. folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
  797. folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
  798. assert [content for content in folder1_contents if content['id'] == 8] # nopep8
  799. assert not [content for content in folder2_contents if content['id'] == 8] # nopep8
  800. # TODO - G.M - 2018-06-163 - Check content
  801. res = self.testapp.put_json(
  802. '/api/v2/workspaces/2/contents/8/move',
  803. params=params,
  804. status=200
  805. )
  806. new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
  807. new_folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
  808. assert not [content for content in new_folder1_contents if content['id'] == 8] # nopep8
  809. assert [content for content in new_folder2_contents if content['id'] == 8] # nopep8
  810. def test_api_put_move_content__ok_200__with_workspace_id(self):
  811. """
  812. Move content
  813. move Apple_Pie (content_id: 8)
  814. from Desserts folder(content_id: 3) to Salads subfolder (content_id: 4)
  815. of workspace Recipes.
  816. """
  817. self.testapp.authorization = (
  818. 'Basic',
  819. (
  820. 'admin@admin.admin',
  821. 'admin@admin.admin'
  822. )
  823. )
  824. params = {
  825. 'new_parent_id': '4', # Salads
  826. 'new_workspace_id': '2',
  827. }
  828. params_folder1 = {
  829. 'parent_id': 3,
  830. 'show_archived': 0,
  831. 'show_deleted': 0,
  832. 'show_active': 1,
  833. }
  834. params_folder2 = {
  835. 'parent_id': 4,
  836. 'show_archived': 0,
  837. 'show_deleted': 0,
  838. 'show_active': 1,
  839. }
  840. folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
  841. folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
  842. assert [content for content in folder1_contents if content['id'] == 8] # nopep8
  843. assert not [content for content in folder2_contents if content['id'] == 8] # nopep8
  844. # TODO - G.M - 2018-06-163 - Check content
  845. res = self.testapp.put_json(
  846. '/api/v2/workspaces/2/contents/8/move',
  847. params=params,
  848. status=200
  849. )
  850. new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
  851. new_folder2_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder2, status=200).json_body # nopep8
  852. assert not [content for content in new_folder1_contents if content['id'] == 8] # nopep8
  853. assert [content for content in new_folder2_contents if content['id'] == 8] # nopep8
  854. def test_api_put_move_content__ok_200__to_another_workspace(self):
  855. """
  856. Move content
  857. move Apple_Pie (content_id: 8)
  858. from Desserts folder(content_id: 3) to Menus subfolder (content_id: 2)
  859. of workspace Business.
  860. """
  861. self.testapp.authorization = (
  862. 'Basic',
  863. (
  864. 'admin@admin.admin',
  865. 'admin@admin.admin'
  866. )
  867. )
  868. params = {
  869. 'new_parent_id': '2', # Menus
  870. }
  871. params_folder1 = {
  872. 'parent_id': 3,
  873. 'show_archived': 0,
  874. 'show_deleted': 0,
  875. 'show_active': 1,
  876. }
  877. params_folder2 = {
  878. 'parent_id': 2,
  879. 'show_archived': 0,
  880. 'show_deleted': 0,
  881. 'show_active': 1,
  882. }
  883. folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
  884. folder2_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_folder2, status=200).json_body # nopep8
  885. assert [content for content in folder1_contents if content['id'] == 8] # nopep8
  886. assert not [content for content in folder2_contents if content['id'] == 8] # nopep8
  887. # TODO - G.M - 2018-06-163 - Check content
  888. res = self.testapp.put_json(
  889. '/api/v2/workspaces/2/contents/8/move',
  890. params=params,
  891. status=200
  892. )
  893. new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
  894. new_folder2_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_folder2, status=200).json_body # nopep8
  895. assert not [content for content in new_folder1_contents if content['id'] == 8] # nopep8
  896. assert [content for content in new_folder2_contents if content['id'] == 8] # nopep8
  897. def test_api_put_move_content__ok_200__to_another_workspace_root(self):
  898. """
  899. Move content
  900. move Apple_Pie (content_id: 8)
  901. from Desserts folder(content_id: 3) to root (content_id: 0)
  902. of workspace Business.
  903. """
  904. self.testapp.authorization = (
  905. 'Basic',
  906. (
  907. 'admin@admin.admin',
  908. 'admin@admin.admin'
  909. )
  910. )
  911. params = {
  912. 'new_parent_id': '0', # root
  913. 'new_workspace_id': '1',
  914. }
  915. params_folder1 = {
  916. 'parent_id': 3,
  917. 'show_archived': 0,
  918. 'show_deleted': 0,
  919. 'show_active': 1,
  920. }
  921. params_folder2 = {
  922. 'parent_id': 0,
  923. 'show_archived': 0,
  924. 'show_deleted': 0,
  925. 'show_active': 1,
  926. }
  927. folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
  928. folder2_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_folder2, status=200).json_body # nopep8
  929. assert [content for content in folder1_contents if content['id'] == 8] # nopep8
  930. assert not [content for content in folder2_contents if content['id'] == 8] # nopep8
  931. # TODO - G.M - 2018-06-163 - Check content
  932. res = self.testapp.put_json(
  933. '/api/v2/workspaces/2/contents/8/move',
  934. params=params,
  935. status=200
  936. )
  937. new_folder1_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_folder1, status=200).json_body # nopep8
  938. new_folder2_contents = self.testapp.get('/api/v2/workspaces/1/contents', params=params_folder2, status=200).json_body # nopep8
  939. assert not [content for content in new_folder1_contents if content['id'] == 8] # nopep8
  940. assert [content for content in new_folder2_contents if content['id'] == 8] # nopep8
  941. def test_api_put_move_content__err_400__wrong_workspace_id(self):
  942. """
  943. Move content
  944. move Apple_Pie (content_id: 8)
  945. from Desserts folder(content_id: 3) to Salads subfolder (content_id: 4)
  946. of workspace Recipes.
  947. Workspace_id of parent_id don't match with workspace_id of workspace
  948. """
  949. self.testapp.authorization = (
  950. 'Basic',
  951. (
  952. 'admin@admin.admin',
  953. 'admin@admin.admin'
  954. )
  955. )
  956. params = {
  957. 'new_parent_id': '4', # Salads
  958. 'new_workspace_id': '1',
  959. }
  960. params_folder1 = {
  961. 'parent_id': 3,
  962. 'show_archived': 0,
  963. 'show_deleted': 0,
  964. 'show_active': 1,
  965. }
  966. params_folder2 = {
  967. 'parent_id': 4,
  968. 'show_archived': 0,
  969. 'show_deleted': 0,
  970. 'show_active': 1,
  971. }
  972. res = self.testapp.put_json(
  973. '/api/v2/workspaces/2/contents/8/move',
  974. params=params,
  975. status=400,
  976. )
  977. def test_api_put_delete_content__ok_200__nominal_case(self):
  978. """
  979. delete content
  980. delete Apple_pie ( content_id: 8, parent_id: 3)
  981. """
  982. self.testapp.authorization = (
  983. 'Basic',
  984. (
  985. 'admin@admin.admin',
  986. 'admin@admin.admin'
  987. )
  988. )
  989. params_active = {
  990. 'parent_id': 3,
  991. 'show_archived': 0,
  992. 'show_deleted': 0,
  993. 'show_active': 1,
  994. }
  995. params_deleted = {
  996. 'parent_id': 3,
  997. 'show_archived': 0,
  998. 'show_deleted': 1,
  999. 'show_active': 0,
  1000. }
  1001. active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
  1002. deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8
  1003. assert [content for content in active_contents if content['id'] == 8] # nopep8
  1004. assert not [content for content in deleted_contents if content['id'] == 8] # nopep8
  1005. # TODO - G.M - 2018-06-163 - Check content
  1006. res = self.testapp.put_json(
  1007. # INFO - G.M - 2018-06-163 - delete Apple_Pie
  1008. '/api/v2/workspaces/2/contents/8/delete',
  1009. status=200
  1010. )
  1011. new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
  1012. new_deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8
  1013. assert not [content for content in new_active_contents if content['id'] == 8] # nopep8
  1014. assert [content for content in new_deleted_contents if content['id'] == 8] # nopep8
  1015. def test_api_put_archive_content__ok_200__nominal_case(self):
  1016. """
  1017. archive content
  1018. archive Apple_pie ( content_id: 8, parent_id: 3)
  1019. """
  1020. self.testapp.authorization = (
  1021. 'Basic',
  1022. (
  1023. 'admin@admin.admin',
  1024. 'admin@admin.admin'
  1025. )
  1026. )
  1027. params_active = {
  1028. 'parent_id': 3,
  1029. 'show_archived': 0,
  1030. 'show_deleted': 0,
  1031. 'show_active': 1,
  1032. }
  1033. params_archived = {
  1034. 'parent_id': 3,
  1035. 'show_archived': 1,
  1036. 'show_deleted': 0,
  1037. 'show_active': 0,
  1038. }
  1039. active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
  1040. archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body # nopep8
  1041. assert [content for content in active_contents if content['id'] == 8] # nopep8
  1042. assert not [content for content in archived_contents if content['id'] == 8] # nopep8
  1043. res = self.testapp.put_json(
  1044. '/api/v2/workspaces/2/contents/8/archive',
  1045. status=200
  1046. )
  1047. new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
  1048. new_archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body # nopep8
  1049. assert not [content for content in new_active_contents if content['id'] == 8] # nopep8
  1050. assert [content for content in new_archived_contents if content['id'] == 8] # nopep8
  1051. def test_api_put_undelete_content__ok_200__nominal_case(self):
  1052. """
  1053. Undelete content
  1054. undelete Bad_Fruit_Salad ( content_id: 14, parent_id: 10)
  1055. """
  1056. self.testapp.authorization = (
  1057. 'Basic',
  1058. (
  1059. 'bob@fsf.local',
  1060. 'foobarbaz'
  1061. )
  1062. )
  1063. params_active = {
  1064. 'parent_id': 10,
  1065. 'show_archived': 0,
  1066. 'show_deleted': 0,
  1067. 'show_active': 1,
  1068. }
  1069. params_deleted = {
  1070. 'parent_id': 10,
  1071. 'show_archived': 0,
  1072. 'show_deleted': 1,
  1073. 'show_active': 0,
  1074. }
  1075. active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
  1076. deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8
  1077. assert not [content for content in active_contents if content['id'] == 14] # nopep8
  1078. assert [content for content in deleted_contents if content['id'] == 14] # nopep8
  1079. res = self.testapp.put_json(
  1080. '/api/v2/workspaces/2/contents/14/undelete',
  1081. status=200
  1082. )
  1083. new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
  1084. new_deleted_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_deleted, status=200).json_body # nopep8
  1085. assert [content for content in new_active_contents if content['id'] == 14] # nopep8
  1086. assert not [content for content in new_deleted_contents if content['id'] == 14] # nopep8
  1087. def test_api_put_unarchive_content__ok_200__nominal_case(self):
  1088. """
  1089. unarchive content,
  1090. unarchive Fruit_salads ( content_id: 13, parent_id: 10)
  1091. """
  1092. self.testapp.authorization = (
  1093. 'Basic',
  1094. (
  1095. 'bob@fsf.local',
  1096. 'foobarbaz'
  1097. )
  1098. )
  1099. params_active = {
  1100. 'parent_id': 10,
  1101. 'show_archived': 0,
  1102. 'show_deleted': 0,
  1103. 'show_active': 1,
  1104. }
  1105. params_archived = {
  1106. 'parent_id': 10,
  1107. 'show_archived': 1,
  1108. 'show_deleted': 0,
  1109. 'show_active': 0,
  1110. }
  1111. active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
  1112. archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body # nopep8
  1113. assert not [content for content in active_contents if content['id'] == 13] # nopep8
  1114. assert [content for content in archived_contents if content['id'] == 13] # nopep8
  1115. res = self.testapp.put_json(
  1116. '/api/v2/workspaces/2/contents/13/unarchive',
  1117. status=200
  1118. )
  1119. new_active_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_active, status=200).json_body # nopep8
  1120. new_archived_contents = self.testapp.get('/api/v2/workspaces/2/contents', params=params_archived, status=200).json_body # nopep8
  1121. assert [content for content in new_active_contents if content['id'] == 13] # nopep8
  1122. assert not [content for content in new_archived_contents if content['id'] == 13] # nopep8