Skip to content

Commit

Permalink
Fix test_tool vote scoring and test_bounty since std bounty ID in url
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeacom committed Apr 23, 2018
1 parent bc9a960 commit 3d48f4b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 20 deletions.
8 changes: 5 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@
},
"extends": "eslint:recommended",
"globals": {
"jQuery",
"$"
"jQuery": true,
"$": true
},
"plugins": [
"html"
],
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 6,
"ecmaFeatures": {
"modules": true,
"arrowFunctions": true
"arrowFunctions": true,
"jsx": true
}
},
"rules": {
Expand Down
7 changes: 6 additions & 1 deletion app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ class Bounty(SuperModel):
BOUNTY_TYPES (list of tuples): The valid bounty types.
EXPERIENCE_LEVELS (list of tuples): The valid experience levels.
PROJECT_LENGTHS (list of tuples): The possible project lengths.
STATUS_CHOICES (list of tuples): The valid status stages.
OPEN_STATUSES (list of str): The list of status types considered open.
CLOSED_STATUSES (list of str): The list of status types considered closed.
"""

Expand Down Expand Up @@ -150,12 +153,14 @@ class Bounty(SuperModel):
submissions_comment = models.IntegerField(null=True, blank=True)
override_status = models.CharField(max_length=255, blank=True)
last_comment_date = models.DateTimeField(null=True, blank=True)
objects = BountyQuerySet.as_manager()
fulfillment_accepted_on = models.DateTimeField(null=True, blank=True)
fulfillment_submitted_on = models.DateTimeField(null=True, blank=True)
fulfillment_started_on = models.DateTimeField(null=True, blank=True)
canceled_on = models.DateTimeField(null=True, blank=True)

# Bounty QuerySet Manager
objects = BountyQuerySet.as_manager()

class Meta:
"""Define metadata associated with Bounty."""

Expand Down
21 changes: 15 additions & 6 deletions app/dashboard/tests/test_dashboard_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"""
from datetime import date, datetime, timedelta

from django.conf import settings

import pytz
from dashboard.models import Bounty, BountyFulfillment, Interest, Profile, Tip, Tool, ToolVote
from economy.models import ConversionRate
Expand Down Expand Up @@ -73,7 +75,7 @@ def test_bounty():
profile=fulfiller_profile,
)
assert str(bounty) == 'foo 3 ETH 2008-10-31 00:00:00+00:00'
assert bounty.url == '/issue/gitcoinco/web/11'
assert bounty.url == f'{settings.BASE_URL}issue/gitcoinco/web/11/{bounty.standard_bounties_id}'
assert bounty.title_or_desc == 'foo'
assert bounty.issue_description_text == 'hello world'
assert bounty.org_name == 'gitcoinco'
Expand Down Expand Up @@ -183,14 +185,21 @@ def test_profile():

def test_tool(self):
"""Test the dashboard Tool model."""
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
the system.''', link="http://gitcoin.co/explorer", link_copy="Try It", active = True, stat_graph = "bounties_fulfilled")
tool = Tool.objects.create(
name='Issue Explorer',
category=Tool.CAT_BASIC,
img='v2/images/why-different/code_great.png',
description='A searchable index of all of the funded work available in the system.',
link='http://gitcoin.co/explorer',
link_copy='Try It',
active=True,
stat_graph='bounties_fulfilled')
profile = Profile.objects.create(
handle='gitcoinco',
data={'type': 'Organization'},
repos_data=[{'contributors': [{'contributions': 50, 'login': 'foo'}]}],
)
vote = ToolVote.objects.create(profile_id=profile.id, value=1)
)
vote = ToolVote.objects.create(profile_id=profile.id, value=1)
tool.votes.add(vote)
assert tool.vote_score() == 1
assert tool.vote_score() == 11
assert tool.link_url == 'http://gitcoin.co/explorer'
20 changes: 10 additions & 10 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const path = require( 'path' );
const webpack = require( 'webpack' );
const BundleTracker = require( 'webpack-bundle-tracker' );
const styleLintPlugin = require( 'stylelint-webpack-plugin' );
const path = require('path');
const webpack = require('webpack');
const BundleTracker = require('webpack-bundle-tracker');
const styleLintPlugin = require('stylelint-webpack-plugin');


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

// Tell django to use this URL to load packages and not use STATIC_URL + bundle_name
Expand All @@ -24,7 +24,7 @@ module.exports = {
failOnError: true,
outputReport: {
filePath: 'checkstyle.xml',
formatter: require( 'eslint-friendly-formatter' )
formatter: require('eslint-friendly-formatter')
}
}
}]
Expand Down Expand Up @@ -57,14 +57,14 @@ module.exports = {
],
resolve: {
alias: {
modulesDirectories: path.resolve( __dirname, 'node_modules' )
modulesDirectories: path.resolve(__dirname, 'node_modules')
},
extensions: ['.js']
}
};


if ( process.env.NODE_ENV === 'production' ) {
if (process.env.NODE_ENV === 'production') {
module.exports.plugins = [
new webpack.DefinePlugin({
'process.env': {
Expand All @@ -77,7 +77,7 @@ if ( process.env.NODE_ENV === 'production' ) {
}
}),
new webpack.optimize.OccurenceOrderPlugin()
]
];
} else {
module.exports.devtool = '#source-map'
module.exports.devtool = '#source-map';
}

0 comments on commit 3d48f4b

Please sign in to comment.