def test_handle_no_interest(self, mock_bounty_startwork_expired,
                                mock_bounty_startwork_expire_warning):
        """Test command expiration start work with not interests."""
        Command().handle()

        assert mock_bounty_startwork_expired.call_count == 0
        assert mock_bounty_startwork_expire_warning.call_count == 0
Ejemplo n.º 2
0
    def test_handle_expire_warning_accepted(self, mock_bounty_startwork_expired,
                                            mock_bounty_startwork_expire_warning,
                                            *args):
        """Test command expiration start work for expire warning."""
        profile = Profile.objects.create(
            data={},
            handle='fred',
            email='*****@*****.**'
        )
        interest = Interest.objects.create(
            profile=profile
        )
        interest.created = timezone.now() - timedelta(days=9)
        interest.acceptance_date = timezone.now() - timedelta(days=9)
        interest.save()

        bounty = Bounty.objects.create(
            title='foo',
            value_in_token=3,
            token_name='USDT',
            web3_created=datetime(2008, 10, 31),
            github_url='https://github.com/gitcoinco/web/issues/1/',
            token_address='0x0',
            issue_description='hello world',
            bounty_owner_github_username='******',
            is_open=True,
            accepted=True,
            expires_date=timezone.now() + timedelta(days=1, hours=1),
            idx_project_length=5,
            project_length='Months',
            bounty_type='Feature',
            experience_level='Intermediate',
            raw_data={},
            idx_status='open',
            bounty_owner_email='*****@*****.**',
            current_bounty=True,
            network='mainnet',
            permission_type='approval'
        )

        bounty.interested.add(interest)
        bounty.save()

        Command().handle()

        assert mock_bounty_startwork_expire_warning.call_count == 1
        assert mock_bounty_startwork_expired.call_count == 0