def create_review_request(self, with_local_site=False, with_diffs=False, summary='Test Summary', description='Test Description', testing_done='Testing', submitter='doc', local_id=1001, status='P', public=False, publish=False, repository=None, id=None, create_repository=False): """Creates a ReviewRequest for testing. The ReviewRequest may optionally be attached to a LocalSite. It's also populated with default data that can be overridden by the caller. If create_repository is True, a Repository will be created automatically. If set, a custom repository cannot be provided. The provided submitter may either be a username or a User object. If publish is True, ReviewRequest.publish() will be called. """ if with_local_site: local_site = LocalSite.objects.get(name=self.local_site_name) else: local_site = None local_id = None if create_repository: assert not repository repository = \ self.create_repository(with_local_site=with_local_site) if not isinstance(submitter, User): submitter = User.objects.get(username=submitter) review_request = ReviewRequest( summary=summary, description=description, testing_done=testing_done, local_site=local_site, local_id=local_id, submitter=submitter, diffset_history=DiffSetHistory.objects.create(), repository=repository, public=public, status=status, id=id) review_request.save() if publish: review_request.publish(review_request.submitter) return review_request
def create_review_request(self, with_local_site=False, with_diffs=False, summary='Test Summary', description='Test Description', testing_done='Testing', submitter='doc', local_id=1001, status='P', public=False, publish=False, repository=None, id=None, create_repository=False): """Creates a ReviewRequest for testing. The ReviewRequest may optionally be attached to a LocalSite. It's also populated with default data that can be overridden by the caller. If create_repository is True, a Repository will be created automatically. If set, a custom repository cannot be provided. The provided submitter may either be a username or a User object. If publish is True, ReviewRequest.publish() will be called. """ if with_local_site: local_site = self.get_local_site(name=self.local_site_name) else: local_site = None local_id = None if create_repository: assert not repository repository = \ self.create_repository(with_local_site=with_local_site) if not isinstance(submitter, User): submitter = User.objects.get(username=submitter) review_request = ReviewRequest( summary=summary, description=description, testing_done=testing_done, local_site=local_site, local_id=local_id, submitter=submitter, diffset_history=DiffSetHistory.objects.create(), repository=repository, public=public, status=status) # Set this separately to avoid issues with CounterField updates. review_request.id = id review_request.save() if publish: review_request.publish(review_request.submitter) return review_request
def create_review_request(self, with_local_site=False, local_site=None, summary='Test Summary', description='Test Description', testing_done='Testing', submitter='doc', branch='my-branch', local_id=1001, bugs_closed='', status='P', public=False, publish=False, commit_id=None, changenum=None, repository=None, id=None, create_repository=False): """Create a ReviewRequest for testing. The ReviewRequest may optionally be attached to a LocalSite. It's also populated with default data that can be overridden by the caller. If create_repository is True, a Repository will be created automatically. If set, a custom repository cannot be provided. The provided submitter may either be a username or a User object. If publish is True, ReviewRequest.publish() will be called. """ if not local_site: if with_local_site: local_site = self.get_local_site(name=self.local_site_name) else: local_site = None if not local_site: local_id = None if create_repository: assert not repository repository = \ self.create_repository(with_local_site=with_local_site) if not isinstance(submitter, User): submitter = User.objects.get(username=submitter) review_request = ReviewRequest( summary=summary, description=description, branch=branch, testing_done=testing_done, local_site=local_site, local_id=local_id, submitter=submitter, diffset_history=DiffSetHistory.objects.create(), repository=repository, public=public, commit_id=commit_id, changenum=changenum, bugs_closed=bugs_closed, status=status) # Set this separately to avoid issues with CounterField updates. review_request.id = id review_request.save() if publish: review_request.publish(review_request.submitter) return review_request
def create_review_request(self, with_local_site=False, local_site=None, summary='Test Summary', description='Test Description', testing_done='Testing', submitter='doc', branch='my-branch', local_id=1001, bugs_closed='', status='P', public=False, publish=False, commit_id=None, changenum=None, time_added=None, last_updated=None, repository=None, id=None, create_repository=False, target_people=None, target_groups=None): """Create a ReviewRequest for testing. The ReviewRequest may optionally be attached to a LocalSite. It's also populated with default data that can be overridden by the caller. If create_repository is True, a Repository will be created automatically. If set, a custom repository cannot be provided. The provided submitter may either be a username or a User object. If publish is True, ReviewRequest.publish() will be called. """ if not local_site: if with_local_site: local_site = self.get_local_site(name=self.local_site_name) else: local_site = None if not local_site: local_id = None if create_repository: assert not repository repository = \ self.create_repository(with_local_site=with_local_site) if not isinstance(submitter, User): submitter = User.objects.get(username=submitter) review_request = ReviewRequest( summary=summary, description=description, branch=branch, testing_done=testing_done, local_site=local_site, local_id=local_id, submitter=submitter, diffset_history=DiffSetHistory.objects.create(), repository=repository, public=public, commit_id=commit_id, changenum=changenum, bugs_closed=bugs_closed, status=status) # Set this separately to avoid issues with CounterField updates. review_request.id = id review_request.save() if target_people: review_request.target_people = target_people if target_groups: review_request.target_groups = target_groups if publish: review_request.publish(review_request.submitter) if time_added and last_updated: ReviewRequest.objects.filter(pk=review_request.pk).update( time_added=time_added, last_updated=last_updated) review_request.time_added = time_added review_request.last_updated = last_updated elif time_added: ReviewRequest.objects.filter(pk=review_request.pk).update( time_added=time_added) review_request.time_added = time_added elif last_updated: ReviewRequest.objects.filter(pk=review_request.pk).update( last_updated=last_updated) review_request.last_updated = last_updated return review_request