def test_profile():
     """Test the dashboard Profile model."""
     bounty = Bounty.objects.create(
         github_url='https://github.com/gitcoinco/web/issues/305',
         web3_created=datetime.now(tz=pytz.UTC),
         expires_date=datetime.now(tz=pytz.UTC) + timedelta(days=1),
         is_open=True,
         raw_data={},
         current_bounty=True,
         bounty_owner_github_username='******',
     )
     tip = Tip.objects.create(
         emails=['*****@*****.**'],
         github_url='https://github.com/gitcoinco/web/issues/305',
         expires_date=datetime.now(tz=pytz.UTC) + timedelta(days=1),
     )
     profile = Profile(
         handle='gitcoinco',
         data={'type': 'Organization'},
     )
     assert str(profile) == 'gitcoinco'
     assert profile.is_org is True
     assert profile.bounties.first() == bounty
     assert profile.tips.first() == tip
     assert profile.desc == '@gitcoinco is a newbie who has participated in 1 funded issue on Gitcoin'
     assert profile.stats == [
         ('newbie', 'Status'),
         (1, 'Total Funded Issues'),
         (1, 'Open Funded Issues'),
         ('0x', 'Loyalty Rate'),
         (0, 'Bounties completed'),
     ]
     assert profile.github_url == 'https://github.com/gitcoinco'
     assert profile.get_relative_url() == '/profile/gitcoinco'
Exemple #2
0
 def test_profile():
     """Test the dashboard Profile model."""
     bounty = Bounty.objects.create(
         github_url='https://github.com/gitcoinco/web/issues/305',
         web3_created=datetime.now(tz=pytz.UTC),
         expires_date=datetime.now(tz=pytz.UTC) + timedelta(days=1),
         is_open=True,
         raw_data={},
         current_bounty=True,
         bounty_owner_github_username='******',
         network='mainnet',
     )
     tip = Tip.objects.create(
         emails=['*****@*****.**'],
         github_url='https://github.com/gitcoinco/web/issues/305',
         expires_date=datetime.now(tz=pytz.UTC) + timedelta(days=1),
     )
     profile = Profile(
         handle='gitcoinco',
         data={'type': 'Organization'},
     )
     assert str(profile) == 'gitcoinco'
     assert profile.is_org is True
     assert profile.bounties.first() == bounty
     assert profile.tips.first() == tip
     assert profile.github_url == 'https://github.com/gitcoinco'
     assert profile.get_relative_url() == '/gitcoinco'