@@ 2225-2286 (lines=62) @@ | ||
2222 | assert content['workspace_id'] == 1 |
|
2223 | assert res[0]['content_id'] != res[1]['content_id'] |
|
2224 | ||
2225 | def test_api__get_workspace_content__ok_200__get_all_folder_content(self): |
|
2226 | """ |
|
2227 | Check obtain workspace folder all contents |
|
2228 | """ |
|
2229 | params = { |
|
2230 | 'parent_id': 10, # TODO - G.M - 30-05-2018 - Find a real id |
|
2231 | 'show_archived': 1, |
|
2232 | 'show_deleted': 1, |
|
2233 | 'show_active': 1, |
|
2234 | # 'content_type': 'any' |
|
2235 | } |
|
2236 | self.testapp.authorization = ( |
|
2237 | 'Basic', |
|
2238 | ( |
|
2239 | '[email protected]', |
|
2240 | '[email protected]' |
|
2241 | ) |
|
2242 | ) |
|
2243 | res = self.testapp.get( |
|
2244 | '/api/v2/workspaces/2/contents', |
|
2245 | status=200, |
|
2246 | params=params, |
|
2247 | ).json_body # nopep8 |
|
2248 | assert len(res) == 3 |
|
2249 | content = res[0] |
|
2250 | assert content['content_type'] == 'html-document' |
|
2251 | assert content['content_id'] == 12 |
|
2252 | assert content['is_archived'] is False |
|
2253 | assert content['is_deleted'] is False |
|
2254 | assert content['label'] == 'New Fruit Salad' |
|
2255 | assert content['parent_id'] == 10 |
|
2256 | assert content['show_in_ui'] is True |
|
2257 | assert content['slug'] == 'new-fruit-salad' |
|
2258 | assert content['status'] == 'open' |
|
2259 | assert set(content['sub_content_types']) == {'comment'} # nopep8 |
|
2260 | assert content['workspace_id'] == 2 |
|
2261 | ||
2262 | content = res[1] |
|
2263 | assert content['content_type'] == 'html-document' |
|
2264 | assert content['content_id'] == 13 |
|
2265 | assert content['is_archived'] is True |
|
2266 | assert content['is_deleted'] is False |
|
2267 | assert content['label'].startswith('Fruit Salad') |
|
2268 | assert content['parent_id'] == 10 |
|
2269 | assert content['show_in_ui'] is True |
|
2270 | assert content['slug'].startswith('fruit-salad') |
|
2271 | assert content['status'] == 'open' |
|
2272 | assert set(content['sub_content_types']) == {'comment'} # nopep8 |
|
2273 | assert content['workspace_id'] == 2 |
|
2274 | ||
2275 | content = res[2] |
|
2276 | assert content['content_type'] == 'html-document' |
|
2277 | assert content['content_id'] == 14 |
|
2278 | assert content['is_archived'] is False |
|
2279 | assert content['is_deleted'] is True |
|
2280 | assert content['label'].startswith('Bad Fruit Salad') |
|
2281 | assert content['parent_id'] == 10 |
|
2282 | assert content['show_in_ui'] is True |
|
2283 | assert content['slug'].startswith('bad-fruit-salad') |
|
2284 | assert content['status'] == 'open' |
|
2285 | assert set(content['sub_content_types']) == {'comment'} # nopep8 |
|
2286 | assert content['workspace_id'] == 2 |
|
2287 | ||
2288 | def test_api__get_workspace_content__ok_200__get_only_active_folder_content(self): # nopep8 |
|
2289 | """ |
|
@@ 1819-1880 (lines=62) @@ | ||
1816 | assert set(content['sub_content_types']) == {'comment'} |
|
1817 | assert content['workspace_id'] == 3 |
|
1818 | ||
1819 | def test_api__get_workspace_content__ok_200__get_all_root_content(self): |
|
1820 | """ |
|
1821 | Check obtain workspace all root contents |
|
1822 | """ |
|
1823 | params = { |
|
1824 | 'parent_id': 0, |
|
1825 | 'show_archived': 1, |
|
1826 | 'show_deleted': 1, |
|
1827 | 'show_active': 1, |
|
1828 | } |
|
1829 | self.testapp.authorization = ( |
|
1830 | 'Basic', |
|
1831 | ( |
|
1832 | '[email protected]', |
|
1833 | 'foobarbaz' |
|
1834 | ) |
|
1835 | ) |
|
1836 | res = self.testapp.get( |
|
1837 | '/api/v2/workspaces/3/contents', |
|
1838 | status=200, |
|
1839 | params=params, |
|
1840 | ).json_body # nopep8 |
|
1841 | # TODO - G.M - 30-05-2018 - Check this test |
|
1842 | assert len(res) == 4 |
|
1843 | content = res[1] |
|
1844 | assert content['content_type'] == 'html-document' |
|
1845 | assert content['content_id'] == 15 |
|
1846 | assert content['is_archived'] is False |
|
1847 | assert content['is_deleted'] is False |
|
1848 | assert content['label'] == 'New Fruit Salad' |
|
1849 | assert content['parent_id'] is None |
|
1850 | assert content['show_in_ui'] is True |
|
1851 | assert content['slug'] == 'new-fruit-salad' |
|
1852 | assert content['status'] == 'open' |
|
1853 | assert set(content['sub_content_types']) == {'comment'} |
|
1854 | assert content['workspace_id'] == 3 |
|
1855 | ||
1856 | content = res[2] |
|
1857 | assert content['content_type'] == 'html-document' |
|
1858 | assert content['content_id'] == 16 |
|
1859 | assert content['is_archived'] is True |
|
1860 | assert content['is_deleted'] is False |
|
1861 | assert content['label'].startswith('Fruit Salad') |
|
1862 | assert content['parent_id'] is None |
|
1863 | assert content['show_in_ui'] is True |
|
1864 | assert content['slug'].startswith('fruit-salad') |
|
1865 | assert content['status'] == 'open' |
|
1866 | assert set(content['sub_content_types']) == {'comment'} |
|
1867 | assert content['workspace_id'] == 3 |
|
1868 | ||
1869 | content = res[3] |
|
1870 | assert content['content_type'] == 'html-document' |
|
1871 | assert content['content_id'] == 17 |
|
1872 | assert content['is_archived'] is False |
|
1873 | assert content['is_deleted'] is True |
|
1874 | assert content['label'].startswith('Bad Fruit Salad') |
|
1875 | assert content['parent_id'] is None |
|
1876 | assert content['show_in_ui'] is True |
|
1877 | assert content['slug'].startswith('bad-fruit-salad') |
|
1878 | assert content['status'] == 'open' |
|
1879 | assert set(content['sub_content_types']) == {'comment'} |
|
1880 | assert content['workspace_id'] == 3 |
|
1881 | ||
1882 | def test_api__get_workspace_content__ok_200__get_only_active_root_content(self): # nopep8 |
|
1883 | """ |