def _setup_watched_forks(self): """ This is a helper method that will generate the mesh of forks, instances, and pull requests linked together """ watched_fork1 = WatchedForkFactory.create( fork='fork/repo1', organization=self.organization) watched_fork2 = WatchedForkFactory.create( fork='fork/repo2', organization=self.organization) watched_fork3 = WatchedForkFactory.create( fork='fork/repo3', organization=self.organization) with mock.patch( 'instance.tests.models.factories.openedx_instance.OpenEdXInstance._write_metadata_to_consul', return_value=(1, True)): instance1 = OpenEdXInstanceFactory() instance2 = OpenEdXInstanceFactory() instance3 = OpenEdXInstanceFactory() WatchedPullRequest.objects.create(fork_name=watched_fork1.fork, branch_name='new-tag', ref_type='tag', watched_fork=watched_fork1, instance=instance1) WatchedPullRequest.objects.create(fork_name=watched_fork1.fork, branch_name='new-tag2', ref_type='tag', watched_fork=watched_fork1, instance=instance2) WatchedPullRequest.objects.create(fork_name=watched_fork2.fork, branch_name='new-tag', ref_type='tag', watched_fork=watched_fork2, instance=instance3) WatchedPullRequest.objects.create(fork_name=watched_fork3.fork, branch_name='new-tag', ref_type='tag', watched_fork=watched_fork3, instance=None) return watched_fork1, watched_fork2, watched_fork3
def _setup_watched_forks(self): """ This is a helper method that will generate the mesh of forks, instances, and pull requests linked together """ watched_fork1 = WatchedForkFactory.create( fork='fork/repo1', organization=self.organization) watched_fork2 = WatchedForkFactory.create( fork='fork/repo2', organization=self.organization) watched_fork3 = WatchedForkFactory.create( fork='fork/repo3', organization=self.organization) instance1 = OpenEdXInstanceFactory() instance2 = OpenEdXInstanceFactory() instance3 = OpenEdXInstanceFactory() WatchedPullRequest.objects.create(fork_name=watched_fork1.fork, branch_name='new-tag', ref_type='tag', watched_fork=watched_fork1, instance=instance1) WatchedPullRequest.objects.create(fork_name=watched_fork1.fork, branch_name='new-tag', ref_type='tag', watched_fork=watched_fork1, instance=instance2) WatchedPullRequest.objects.create(fork_name=watched_fork2.fork, branch_name='new-tag', ref_type='tag', watched_fork=watched_fork2, instance=instance3) WatchedPullRequest.objects.create(fork_name=watched_fork3.fork, branch_name='new-tag', ref_type='tag', watched_fork=watched_fork3, instance=None) return watched_fork1, watched_fork2, watched_fork3