def test_submit_work_or_new_bounty_when_bounty_exists(self): """Test submit_work_or_new_bounty_text when bounty is active.""" from dashboard.models import Bounty from datetime import datetime Bounty.objects.create( title='foo', value_in_token=3, token_name='ETH', web3_created=datetime(2008, 10, 31), github_url='https://github.com/test_owner/gitcoin/issues/1234', token_address='0x0', issue_description='hello world', bounty_owner_github_username='******', is_open=False, accepted=True, expires_date=datetime(2008, 11, 30), idx_project_length=5, project_length='Months', bounty_type='Feature', experience_level='Intermediate', raw_data={}, ) submit_link = f'{settings.BASE_URL}issue/test_owner/gitcoin/1234' target_text = f'To finish claiming this bounty please [visit this link]({submit_link})' text = submit_work_or_new_bounty_text('test_owner', 'gitcoin', '1234') self.assertEqual(text, target_text)
def test_submit_work_or_new_bounty_when_bounty_doesnt_exist(self): """Test submit_work_or_new_bounty_text when bounty isn't active.""" issue_link = f'https://github.com/test_owner/gitcoin/issues/1234' bounty_link = f'{settings.BASE_URL}funding/new?source={issue_link}' target_text = 'No active bounty for this issue, consider create the bounty please'\ f' [visit this link]({bounty_link}).\n\n ' \ 'PS Make sure you\'re logged into Metamask!' text = submit_work_or_new_bounty_text('test_owner', 'gitcoin', '1234') self.assertEqual(text, target_text)