Ejemplo n.º 1
0
    def test_sync_issues(self, m__sync_issue, m_timezone):
        m_timezone.now.return_value = mock.Mock(minute=10)

        user = GithubUser.objects.create(id=1, logins=['username'])
        repo = Repository.objects.create(id=1, name='repo', private=False)
        open_issue = Issue.objects.create(
            id=1,
            creater=user,
            created_at=timezone.now(),
            number=1,
            title=u'my fake open issue',
            closed_at=None,
            repository=repo,
        )
        Issue.objects.create(
            id=2,
            creater=user,
            created_at=timezone.now(),
            number=2,
            title=u'my fake closed issue',
            closed_at=timezone.now(),
            repository=repo,
        )

        sync_issues()

        self.assertEqual(m__sync_issue.call_count, 1)
        m__sync_issue.assert_called_once_with(open_issue)
Ejemplo n.º 2
0
 def handle(self, *args, **kwargs):
     sync_issues()