@@ 1830-1882 (lines=53) @@ | ||
1827 | item = res.all()[0] |
|
1828 | eq_(original_id, item.content_id) |
|
1829 | ||
1830 | def test_search_in_description(self): |
|
1831 | # HACK - D.A. - 2015-03-09 |
|
1832 | # This test is based on a bug which does NOT return results found |
|
1833 | # at root of a workspace (eg a folder) |
|
1834 | ||
1835 | uapi = UserApi( |
|
1836 | session=self.session, |
|
1837 | config=self.app_config, |
|
1838 | current_user=None, |
|
1839 | ) |
|
1840 | group_api = GroupApi( |
|
1841 | current_user=None, |
|
1842 | session=self.session, |
|
1843 | ) |
|
1844 | groups = [group_api.get_one(Group.TIM_USER), |
|
1845 | group_api.get_one(Group.TIM_MANAGER), |
|
1846 | group_api.get_one(Group.TIM_ADMIN)] |
|
1847 | ||
1848 | user = uapi.create_user(email='this.is@user', |
|
1849 | groups=groups, save_now=True) |
|
1850 | ||
1851 | workspace = WorkspaceApi( |
|
1852 | current_user=user, |
|
1853 | session=self.session |
|
1854 | ).create_workspace( |
|
1855 | 'test workspace', |
|
1856 | save_now=True, |
|
1857 | ) |
|
1858 | ||
1859 | api = ContentApi( |
|
1860 | current_user=user, |
|
1861 | session=self.session, |
|
1862 | config=self.app_config, |
|
1863 | ) |
|
1864 | a = api.create(ContentType.Folder, workspace, None, |
|
1865 | 'this is randomized folder', True) |
|
1866 | p = api.create(ContentType.Page, workspace, a, |
|
1867 | 'this is dummy label content', True) |
|
1868 | ||
1869 | with new_revision( |
|
1870 | tm=transaction.manager, |
|
1871 | session=self.session, |
|
1872 | content=p, |
|
1873 | ): |
|
1874 | p.description = 'This is some amazing test' |
|
1875 | ||
1876 | api.save(p) |
|
1877 | original_id = p.content_id |
|
1878 | ||
1879 | res = api.search(['dummy']) |
|
1880 | eq_(1, len(res.all())) |
|
1881 | item = res.all()[0] |
|
1882 | eq_(original_id, item.content_id) |
|
1883 | ||
1884 | def test_search_in_label_or_description(self): |
|
1885 | # HACK - D.A. - 2015-03-09 |
|
@@ 1776-1828 (lines=53) @@ | ||
1773 | eq_(ActionDescription.UNDELETION, updated2.revision_type) |
|
1774 | eq_(u1id, updated2.owner_id) |
|
1775 | ||
1776 | def test_search_in_label(self): |
|
1777 | # HACK - D.A. - 2015-03-09 |
|
1778 | # This test is based on a bug which does NOT return results found |
|
1779 | # at root of a workspace (eg a folder) |
|
1780 | uapi = UserApi( |
|
1781 | session=self.session, |
|
1782 | config=self.app_config, |
|
1783 | current_user=None, |
|
1784 | ) |
|
1785 | group_api = GroupApi( |
|
1786 | current_user=None, |
|
1787 | session=self.session, |
|
1788 | ) |
|
1789 | groups = [group_api.get_one(Group.TIM_USER), |
|
1790 | group_api.get_one(Group.TIM_MANAGER), |
|
1791 | group_api.get_one(Group.TIM_ADMIN)] |
|
1792 | ||
1793 | user = uapi.create_user(email='this.is@user', |
|
1794 | groups=groups, save_now=True) |
|
1795 | ||
1796 | workspace = WorkspaceApi( |
|
1797 | current_user=user, |
|
1798 | session=self.session |
|
1799 | ).create_workspace( |
|
1800 | 'test workspace', |
|
1801 | save_now=True |
|
1802 | ) |
|
1803 | ||
1804 | api = ContentApi( |
|
1805 | current_user=user, |
|
1806 | session=self.session, |
|
1807 | config=self.app_config, |
|
1808 | ||
1809 | ) |
|
1810 | a = api.create(ContentType.Folder, workspace, None, |
|
1811 | 'this is randomized folder', True) |
|
1812 | p = api.create(ContentType.Page, workspace, a, |
|
1813 | 'this is randomized label content', True) |
|
1814 | ||
1815 | with new_revision( |
|
1816 | session=self.session, |
|
1817 | tm=transaction.manager, |
|
1818 | content=p, |
|
1819 | ): |
|
1820 | p.description = 'This is some amazing test' |
|
1821 | ||
1822 | api.save(p) |
|
1823 | original_id = p.content_id |
|
1824 | ||
1825 | res = api.search(['randomized']) |
|
1826 | eq_(1, len(res.all())) |
|
1827 | item = res.all()[0] |
|
1828 | eq_(original_id, item.content_id) |
|
1829 | ||
1830 | def test_search_in_description(self): |
|
1831 | # HACK - D.A. - 2015-03-09 |