Skip to content

Commit 3d48f4b

Browse files
committed
Fix test_tool vote scoring and test_bounty since std bounty ID in url
1 parent bc9a960 commit 3d48f4b

File tree

4 files changed

+36
-20
lines changed

4 files changed

+36
-20
lines changed

.eslintrc

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@
99
},
1010
"extends": "eslint:recommended",
1111
"globals": {
12-
"jQuery",
13-
"$"
12+
"jQuery": true,
13+
"$": true
1414
},
1515
"plugins": [
1616
"html"
1717
],
1818
"parser": "babel-eslint",
1919
"parserOptions": {
2020
"sourceType": "module",
21+
"ecmaVersion": 6,
2122
"ecmaFeatures": {
2223
"modules": true,
23-
"arrowFunctions": true
24+
"arrowFunctions": true,
25+
"jsx": true
2426
}
2527
},
2628
"rules": {

app/dashboard/models.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ class Bounty(SuperModel):
7878
BOUNTY_TYPES (list of tuples): The valid bounty types.
7979
EXPERIENCE_LEVELS (list of tuples): The valid experience levels.
8080
PROJECT_LENGTHS (list of tuples): The possible project lengths.
81+
STATUS_CHOICES (list of tuples): The valid status stages.
82+
OPEN_STATUSES (list of str): The list of status types considered open.
83+
CLOSED_STATUSES (list of str): The list of status types considered closed.
8184
8285
"""
8386

@@ -150,12 +153,14 @@ class Bounty(SuperModel):
150153
submissions_comment = models.IntegerField(null=True, blank=True)
151154
override_status = models.CharField(max_length=255, blank=True)
152155
last_comment_date = models.DateTimeField(null=True, blank=True)
153-
objects = BountyQuerySet.as_manager()
154156
fulfillment_accepted_on = models.DateTimeField(null=True, blank=True)
155157
fulfillment_submitted_on = models.DateTimeField(null=True, blank=True)
156158
fulfillment_started_on = models.DateTimeField(null=True, blank=True)
157159
canceled_on = models.DateTimeField(null=True, blank=True)
158160

161+
# Bounty QuerySet Manager
162+
objects = BountyQuerySet.as_manager()
163+
159164
class Meta:
160165
"""Define metadata associated with Bounty."""
161166

app/dashboard/tests/test_dashboard_models.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
"""
2020
from datetime import date, datetime, timedelta
2121

22+
from django.conf import settings
23+
2224
import pytz
2325
from dashboard.models import Bounty, BountyFulfillment, Interest, Profile, Tip, Tool, ToolVote
2426
from economy.models import ConversionRate
@@ -73,7 +75,7 @@ def test_bounty():
7375
profile=fulfiller_profile,
7476
)
7577
assert str(bounty) == 'foo 3 ETH 2008-10-31 00:00:00+00:00'
76-
assert bounty.url == '/issue/gitcoinco/web/11'
78+
assert bounty.url == f'{settings.BASE_URL}issue/gitcoinco/web/11/{bounty.standard_bounties_id}'
7779
assert bounty.title_or_desc == 'foo'
7880
assert bounty.issue_description_text == 'hello world'
7981
assert bounty.org_name == 'gitcoinco'
@@ -183,14 +185,21 @@ def test_profile():
183185

184186
def test_tool(self):
185187
"""Test the dashboard Tool model."""
186-
tool = Tool.objects.create(name="Issue Explorer", category="BASIC", img="v2/images/why-different/code_great.png", description='''A searchable index of all of the funded work available in
187-
the system.''', link="http://gitcoin.co/explorer", link_copy="Try It", active = True, stat_graph = "bounties_fulfilled")
188+
tool = Tool.objects.create(
189+
name='Issue Explorer',
190+
category=Tool.CAT_BASIC,
191+
img='v2/images/why-different/code_great.png',
192+
description='A searchable index of all of the funded work available in the system.',
193+
link='http://gitcoin.co/explorer',
194+
link_copy='Try It',
195+
active=True,
196+
stat_graph='bounties_fulfilled')
188197
profile = Profile.objects.create(
189198
handle='gitcoinco',
190199
data={'type': 'Organization'},
191200
repos_data=[{'contributors': [{'contributions': 50, 'login': 'foo'}]}],
192-
)
193-
vote = ToolVote.objects.create(profile_id=profile.id, value=1)
201+
)
202+
vote = ToolVote.objects.create(profile_id=profile.id, value=1)
194203
tool.votes.add(vote)
195-
assert tool.vote_score() == 1
204+
assert tool.vote_score() == 11
196205
assert tool.link_url == 'http://gitcoin.co/explorer'

webpack.config.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
const path = require( 'path' );
2-
const webpack = require( 'webpack' );
3-
const BundleTracker = require( 'webpack-bundle-tracker' );
4-
const styleLintPlugin = require( 'stylelint-webpack-plugin' );
1+
const path = require('path');
2+
const webpack = require('webpack');
3+
const BundleTracker = require('webpack-bundle-tracker');
4+
const styleLintPlugin = require('stylelint-webpack-plugin');
55

66

77
module.exports = {
88
devtool: 'inline-source-map',
99
output: {
10-
path: path.resolve( __dirname, 'app/static/bundles' ),
10+
path: path.resolve(__dirname, 'app/static/bundles'),
1111
filename: '[name]-[hash].js',
1212

1313
// Tell django to use this URL to load packages and not use STATIC_URL + bundle_name
@@ -24,7 +24,7 @@ module.exports = {
2424
failOnError: true,
2525
outputReport: {
2626
filePath: 'checkstyle.xml',
27-
formatter: require( 'eslint-friendly-formatter' )
27+
formatter: require('eslint-friendly-formatter')
2828
}
2929
}
3030
}]
@@ -57,14 +57,14 @@ module.exports = {
5757
],
5858
resolve: {
5959
alias: {
60-
modulesDirectories: path.resolve( __dirname, 'node_modules' )
60+
modulesDirectories: path.resolve(__dirname, 'node_modules')
6161
},
6262
extensions: ['.js']
6363
}
6464
};
6565

6666

67-
if ( process.env.NODE_ENV === 'production' ) {
67+
if (process.env.NODE_ENV === 'production') {
6868
module.exports.plugins = [
6969
new webpack.DefinePlugin({
7070
'process.env': {
@@ -77,7 +77,7 @@ if ( process.env.NODE_ENV === 'production' ) {
7777
}
7878
}),
7979
new webpack.optimize.OccurenceOrderPlugin()
80-
]
80+
];
8181
} else {
82-
module.exports.devtool = '#source-map'
82+
module.exports.devtool = '#source-map';
8383
}

0 commit comments

Comments
 (0)