Skip to content

Commit

Permalink
Merge pull request #1788 from SEED-platform/develop
Browse files Browse the repository at this point in the history
merge to master to trigger Docker Hub builds
  • Loading branch information
nllong authored Jan 10, 2019
2 parents 0c2633e + 9d7bb3a commit 7d89c60
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ src/
*node_modules*
bower_components/

# JetBrainz tends to suggest a venv directory in the project root for virtual environments
venv/

package-lock.json
dump.rdb
log/*.log
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ lxml==4.2.5
probablepeople==0.5.4

enum34==1.1.6 # enum34 needs to be specified to support cryptography and oauth2
oauthlib==2.0.2
jwt-oauth2>=0.1.1
django-oauth-toolkit==0.12.0
django-braces>=1.11.0

future==0.16.0
34 changes: 25 additions & 9 deletions seed/tests/test_portfoliomanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"""
import json
import os
from unittest import skipIf
import requests
from unittest import skip, skipIf

from django.core.urlresolvers import reverse_lazy
from django.test import TestCase
Expand All @@ -19,6 +20,27 @@
from seed.views.portfoliomanager import PortfolioManagerImport


PM_UN = 'SEED_PM_UN'
PM_PW = 'SEED_PM_PW'
pm_skip_test_check = skipIf(
not os.environ.get(PM_UN, False) and not os.environ.get(PM_PW, False),
'Cannot run "expect-pass" PM unit tests without %s and %s in environment' % (PM_UN, PM_PW)
)

# override this decorator for more pressing conditions
try:
pm_avail_check = requests.get('http://isthewallbuilt.us/api.json', timeout=5)
string_response = pm_avail_check.json()['status']
if string_response == 'no':
skip_due_to_espm_down = True
else:
skip_due_to_espm_down = False
if skip_due_to_espm_down:
pm_skip_test_check = skip('ESPM is likely down temporarily, ESPM tests will not run')
except Exception:
pass


class PortfolioManagerImportTest(TestCase):
def test_unsuccessful_login(self):
# To test a successful login, we'd have to include valid PM credentials, which we don't want to do
Expand Down Expand Up @@ -86,6 +108,7 @@ def test_template_list_interface_no_password(self):
self.assertEqual('error', data['status'])
self.assertIn('missing password', data['message'])

@pm_skip_test_check
def test_template_list_invalid_credentials(self):
resp = self.client.post(
reverse_lazy('api:v2.1:portfolio_manager-template-list'),
Expand All @@ -103,14 +126,6 @@ def test_template_list_invalid_credentials(self):
self.assertIn('Check credentials.', data['message'])


PM_UN = 'SEED_PM_UN'
PM_PW = 'SEED_PM_PW'
pm_skip_test_check = skipIf(
not os.environ.get(PM_UN, False) and not os.environ.get(PM_PW, False),
'Cannot run "expect-pass" PM unit tests without %s and %s in environment' % (PM_UN, PM_PW)
)


class PortfolioManagerTemplateListViewTestsSuccess(TestCase):

def setUp(self):
Expand Down Expand Up @@ -231,6 +246,7 @@ def test_report_interface_no_template(self):
self.assertEqual('error', data['status'])
self.assertIn('missing template', data['message'])

@pm_skip_test_check
def test_report_invalid_credentials(self):
resp = self.client.post(
reverse_lazy('api:v2.1:portfolio_manager-report'),
Expand Down

0 comments on commit 7d89c60

Please sign in to comment.