Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thelostone-mc committed May 20, 2020
1 parent b8fb3c9 commit 01bd3ef
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ def keywords_list(self):

@property
def fulfillers_handles(self):
bounty_fulfillers = self.fulfillments.filter(accepted=True).values_list('fulfiller_github_username', flat=True)
bounty_fulfillers = self.fulfillments.filter(accepted=True).values_list('profile__handle', flat=True)
tip_fulfillers = self.tips.values_list('username', flat=True)
return list(bounty_fulfillers) + list(tip_fulfillers)

Expand Down
2 changes: 0 additions & 2 deletions app/dashboard/tests/test_users_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,13 @@ def setup_bounties():

BountyFulfillment.objects.create(
fulfiller_address='0x0000000000000000000000000000000000000000',
fulfiller_github_username='user1',
accepted=True,
bounty=Bounty.objects.first(),
profile=User.objects.filter(username='user1').first().profile
)

BountyFulfillment.objects.create(
fulfiller_address='0x0000000000000000000000000000000000000000',
fulfiller_github_username='user19',
accepted=True,
bounty=Bounty.objects.last(),
profile=User.objects.last().profile
Expand Down
2 changes: 1 addition & 1 deletion app/dataviz/d3_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ def viz_draggable(request, key='email_open'):
if request.GET.get('data'):
output = []
for username in usernames:
these_bounties = bfs.filter(fulfiller_github_username=username)
these_bounties = bfs.filter(profile__handle=username)
start_date = timezone.now() - timezone.timedelta(days=180)
income = []
lifeExpectancy = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def setUp(self):
self.bounty_value = 3
self.bounty_payer_handle = 'flintstone'
self.bounty_earner_handle = 'freddy'
self.fulfiller_handle = 'bambam'

self.bounty_payer_profile = Profile.objects.create(
data={},
Expand Down Expand Up @@ -89,16 +88,12 @@ def setUp(self):
network='mainnet',
metadata={"issueKeywords": "Python, Shell"},
)
self.fulfiller_profile = Profile.objects.create(
data={},
handle=self.fulfiller_handle,
hide_profile=False,
)

BountyFulfillment.objects.create(
fulfiller_address='0x0000000000000000000000000000000000000000',
bounty=self.bounty,
accepted=True,
profile=self.fulfiller_profile,
profile=self.bounty_earner_profile,
)

self.tip_value = 7
Expand Down Expand Up @@ -141,7 +136,6 @@ def setUp(self):
def tearDown(self):
self.bounty_payer_profile.delete()
self.bounty_earner_profile.delete()
self.fulfiller_profile.delete()
self.tip_username_profile.delete()
self.tip_from_username_profile.delete()

Expand Down
6 changes: 5 additions & 1 deletion app/marketing/tests/management/commands/test_expiration.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@ def test_handle_no_users(self, mock_func):
current_bounty=True,
network='mainnet'
)
fulfiller_profile = Profile.objects.create(
data={},
handle='fred'
)
BountyFulfillment.objects.create(
fulfiller_address='0x0000000000000000000000000000000000000000',
bounty=bounty,
profile=None,
profile=fulfiller_profile,
)

Command().handle()
Expand Down
20 changes: 17 additions & 3 deletions app/marketing/tests/management/commands/test_sync_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from django.utils import timezone

from dashboard.models import Bounty, BountyFulfillment
from dashboard.models import Bounty, BountyFulfillment, Profile
from marketing.management.commands.sync_keywords import Command
from marketing.models import Keyword
from test_plus.test import TestCase
Expand Down Expand Up @@ -109,14 +109,28 @@ def test_handle_complex(self):
}
)

fulfiller_profile = Profile.objects.create(
data={},
handle='fred',
email='[email protected]'
)

BountyFulfillment.objects.create(
fulfiller_address='0x0000000000000000000000000000000000000000',
bounty=bounty
bounty=bounty,
profile=fulfiller_profile
)

fulfiller_profile = Profile.objects.create(
data={},
handle='',
email='[email protected]'
)

BountyFulfillment.objects.create(
fulfiller_address='0x0000000000000000000000000000000000000000',
bounty=bounty
bounty=bounty,
profile=fulfiller_profile
)
Command().handle()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import marketing
import marketing.management.commands.sync_pull_request_with_bounty_fulfillments
from dashboard.models import Bounty, BountyFulfillment
from dashboard.models import Bounty, BountyFulfillment, Profile
from test_plus.test import TestCase


Expand Down Expand Up @@ -63,9 +63,16 @@ def setUp(self):
current_bounty=True
)

fulfiller_profile = Profile.objects.create(
data={},
handle='samplegitcoindeveloper1',
email='[email protected]'
)

BountyFulfillment.objects.create(
fulfiller_address='0x0000000000000000000000000000000000000000',
accepted=False,
profile=fulfiller_profile,
bounty=Bounty.objects.last()
)

Expand Down
2 changes: 1 addition & 1 deletion app/retail/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def render_quarterly_stats(to_email, platform_wide_stats):


def render_funder_payout_reminder(**kwargs):
kwargs['bounty_fulfillment'] = kwargs['bounty'].fulfillments.filter(fulfiller_github_username=kwargs['github_username']).last()
kwargs['bounty_fulfillment'] = kwargs['bounty'].fulfillments.filter(profile__handle=kwargs['github_username']).last()
response_html = premailer_transform(render_to_string("emails/funder_payout_reminder.html", kwargs))
response_txt = ''
return response_html, response_txt
Expand Down

0 comments on commit 01bd3ef

Please sign in to comment.