def test_re_market_fails_after_reaching_re_market_limit(): if settings.RE_MARKET_LIMIT == 2: bounty = Bounty.objects.create( title='CanRemarketFalseTest', idx_status=0, is_open=True, web3_created=datetime(2008, 10, 31, tzinfo=UTC), expires_date=datetime(2008, 11, 30, tzinfo=UTC), last_remarketed=datetime(2008, 10, 31, tzinfo=UTC), github_url='https://github.com/gitcoinco/web/issues/12345678', raw_data={}) assert bounty.remarketed_count == 0 result = re_market_bounty(bounty, False) assert result['success'] is True assert bounty.remarketed_count == 1 bounty.last_remarketed = timezone.now() - timezone.timedelta( hours=2) result = re_market_bounty(bounty, False) assert result['success'] is True assert bounty.remarketed_count == 2 result = re_market_bounty(bounty, False) assert result['success'] is False assert result[ 'msg'] == "The issue was not remarketed due to reaching the remarket limit (2)."
def test_can_successfully_re_market_a_bounty_twice(): if settings.RE_MARKET_LIMIT == 2: bounty = Bounty.objects.create( title='CanRemarketTrueTest', idx_status=0, is_open=True, web3_created=datetime(2008, 10, 31, tzinfo=UTC), expires_date=datetime(2008, 11, 30, tzinfo=UTC), last_remarketed=datetime(2008, 10, 31, tzinfo=UTC), github_url='https://github.com/gitcoinco/web/issues/12345678', raw_data={}) result = re_market_bounty(bounty, False) assert result['success'] is True assert result[ 'msg'] == "The issue will appear at the top of the issue explorer. You will be able to remarket this bounty 1 more time if a contributor does not pick this up." assert bounty.remarketed_count == 1 bounty.last_remarketed = timezone.now() - timezone.timedelta( hours=2) result = re_market_bounty(bounty, False) assert result['success'] is True assert result[ 'msg'] == "The issue will appear at the top of the issue explorer. Please note this is the last time the issue is able to be remarketed." assert bounty.remarketed_count == 2
def test_re_market_fails_after_re_marketing_in_quick_succession(): bounty = Bounty.objects.create( title='CanRemarketFalseTest', idx_status=0, is_open=True, web3_created=datetime(2008, 10, 31, tzinfo=UTC), expires_date=datetime(2008, 11, 30, tzinfo=UTC), github_url='https://github.com/gitcoinco/web/issues/12345678', raw_data={}) assert bounty.remarketed_count == 0 result = re_market_bounty(bounty, False) assert result['success'] is True assert bounty.remarketed_count == 1 result = re_market_bounty(bounty, False) assert result['success'] is False assert result[ 'msg'] == f'As you recently remarketed this issue, you need to wait {settings.MINUTES_BETWEEN_RE_MARKETING} minutes before remarketing this issue again.'