def test_single_project(self): skip_test() u_to = User("admin") u_from = User("testuser") to_proj = self._prj("test", "admin") self._add(to_proj, u_to, "README.md", "hi") from_proj = self._prj("testuser/test", "testuser", to_proj.id) self._add(from_proj, u_from, "README.md", "hello") pullreq = PullRequest.open(from_proj, "master", to_proj, "master") ticket = Ticket(None, None, to_proj.id, "title", "desc", "testuser", None, None) pullreq = add_pull(ticket, pullreq, u_from) iss = ProjectIssue.add(title='title1', description='desc1', creator='owner', project=to_proj.id) IssuePRSearch.index_a_project(to_proj) res = IssueSearch.search_a_phrase('title1', to_proj.id) res = SearchEngine.decode(res, ('issue_id',)) res = [id for id, in res] assert len(res) == 1 assert res[0] == iss.id res = PullRequestSearch.search_a_phrase('title', to_proj.id) res = SearchEngine.decode(res, ('issue_id',)) res = [id for id, in res] assert len(res) == 1
def test_single_project(self): skip_test() u_to = User("admin") u_from = User("testuser") to_proj = self._prj("test", "admin") self._add(to_proj, u_to, "README.md", "hi") from_proj = self._prj("testuser/test", "testuser", to_proj.id) self._add(from_proj, u_from, "README.md", "hello") pullreq = PullRequest.open(from_proj, "master", to_proj, "master") ticket = Ticket(None, None, to_proj.id, "title", "desc", "testuser", None, None) pullreq = add_pull(ticket, pullreq, u_from) iss = ProjectIssue.add(title='title1', description='desc1', creator='owner', project=to_proj.id) IssuePRSearch.index_a_project(to_proj) res = IssueSearch.search_a_phrase('title1', to_proj.id) res = SearchEngine.decode(res, ('issue_id', )) res = [id for id, in res] assert len(res) == 1 assert res[0] == iss.id res = PullRequestSearch.search_a_phrase('title', to_proj.id) res = SearchEngine.decode(res, ('issue_id', )) res = [id for id, in res] assert len(res) == 1
def test_multiple_project(self): skip_test() p1 = self._prj("test_1") p2 = self._prj("test_2") iss1 = ProjectIssue.add(title='title1', description='desc1', creator='owner', project=p1.id) iss2 = ProjectIssue.add(title='title1', description='desc1', creator='owner', project=p2.id) IssueSearch.index_a_project_issue(p1) IssueSearch.index_a_project_issue(p2) res = IssueSearch.search_a_phrase('title1', p1.id) res = SearchEngine.decode(res, ('issue_id',)) res = [id for id, in res] assert len(res) == 1 assert res[0] == iss1.id res = IssueSearch.search_a_phrase('title1', p2.id) res = SearchEngine.decode(res, ('issue_id',)) res = [id for id, in res] assert len(res) == 1 assert res[0] == iss2.id
def test_single_project(self): skip_test() p = self._prj("test") iss1 = ProjectIssue.add(title='title1', description='desc1', creator='owner', project=p.id) IssueSearch.index_a_project_issue(p) res = IssueSearch.search_a_phrase('owner', p.id) res = SearchEngine.decode(res, ('issue_id',)) res = [id for id, in res] assert len(res) == 1 assert res[0] == iss1.id iss2 = ProjectIssue.add(title='title2', description='desc2', creator='owner', project=p.id) IssueSearch.index_a_project_issue(p) res = IssueSearch.search_a_phrase('owner', p.id) res = SearchEngine.decode(res, ('issue_id',)) res = [id for id, in res] assert len(res) == 2 assert iss1.id in res assert iss2.id in res
def test_multiple_project(self): skip_test() p1 = self._prj("test_1") p2 = self._prj("test_2") iss1 = ProjectIssue.add(title='title1', description='desc1', creator='owner', project=p1.id) iss2 = ProjectIssue.add(title='title1', description='desc1', creator='owner', project=p2.id) IssueSearch.index_a_project_issue(p1) IssueSearch.index_a_project_issue(p2) res = IssueSearch.search_a_phrase('title1', p1.id) res = SearchEngine.decode(res, ('issue_id', )) res = [id for id, in res] assert len(res) == 1 assert res[0] == iss1.id res = IssueSearch.search_a_phrase('title1', p2.id) res = SearchEngine.decode(res, ('issue_id', )) res = [id for id, in res] assert len(res) == 1 assert res[0] == iss2.id
def test_single_project(self): skip_test() p = self._prj("test") iss1 = ProjectIssue.add(title='title1', description='desc1', creator='owner', project=p.id) IssueSearch.index_a_project_issue(p) res = IssueSearch.search_a_phrase('owner', p.id) res = SearchEngine.decode(res, ('issue_id', )) res = [id for id, in res] assert len(res) == 1 assert res[0] == iss1.id iss2 = ProjectIssue.add(title='title2', description='desc2', creator='owner', project=p.id) IssueSearch.index_a_project_issue(p) res = IssueSearch.search_a_phrase('owner', p.id) res = SearchEngine.decode(res, ('issue_id', )) res = [id for id, in res] assert len(res) == 2 assert iss1.id in res assert iss2.id in res
def test_single_project(self): skip_test() u_to = User("admin") u_from = User("testuser") to_proj = self._prj("test", "admin") self._add(to_proj, u_to, "README.md", "hi") from_proj = self._prj("testuser/test", "testuser", to_proj.id) self._add(from_proj, u_from, "README.md", "hello") pullreq = PullRequest.open(from_proj, "master", to_proj, "master") ticket = Ticket(None, None, to_proj.id, "title", "desc", "testuser", None, None) pullreq = add_pull(ticket, pullreq, u_from) ticket = pullreq.ticket PullRequestSearch.index_a_project_pr(to_proj) res = PullRequestSearch.search_a_phrase('title', to_proj.id) res = SearchEngine.decode(res, ('to_proj_id',)) res = [id for id, in res] assert len(res) == 1
def test_single_project(self): skip_test() u_to = User("admin") u_from = User("testuser") to_proj = self._prj("test", "admin") self._add(to_proj, u_to, "README.md", "hi") from_proj = self._prj("testuser/test", "testuser", to_proj.id) self._add(from_proj, u_from, "README.md", "hello") pullreq = PullRequest.open(from_proj, "master", to_proj, "master") ticket = Ticket(None, None, to_proj.id, "title", "desc", "testuser", None, None) pullreq = add_pull(ticket, pullreq, u_from) ticket = pullreq.ticket PullRequestSearch.index_a_project_pr(to_proj) res = PullRequestSearch.search_a_phrase('title', to_proj.id) res = SearchEngine.decode(res, ('to_proj_id', )) res = [id for id, in res] assert len(res) == 1