Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
update split_parties location
test_senate using MA, not CA
travis-ci move from .org to .com
  • Loading branch information
jlev committed Jan 20, 2021
1 parent a641ad7 commit 1e8abc8
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ python:
- "3.7"
install: "pip install -r requirements/development.txt"
cache: pip
script: pytest -m "not slow" --cov=call_server/
script: py.test -m "not slow" --cov=call_server/
after_sucess:
coveralls
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ This application should be easy to host on Heroku, with Docker, or directly on a

Read detailed instrustions at [INSTALLATION.md](INSTALLATION.md)

[![Build Status](https://travis-ci.org/OpenSourceActivismTech/call-power.svg?branch=master)](https://travis-ci.org/OpenSourceActivismTech/call-power)
Testing
-------
`python tests/run.py`

[![Build Status](https://travis-ci.com/OpenSourceActivismTech/call-power.svg?branch=master)](https://travis-ci.com/OpenSourceActivismTech/call-power)
[![Coverage Status](https://coveralls.io/repos/github/OpenSourceActivismTech/call-power/badge.svg?branch=master)](https://coveralls.io/github/OpenSourceActivismTech/call-power?branch=master)

Political Data
Expand Down
3 changes: 2 additions & 1 deletion requirements/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ cssmin==0.2.0
coverage==4.4
coveralls==1.1
pip-upgrade
pytest-cov==2.10.1
pytest-cov==2.10.1
pytest-dotenv==0.5.2
2 changes: 2 additions & 0 deletions tests/run.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import pytest
from dotenv import load_dotenv

from flask_testing import TestCase

if __name__ == '__main__' and __package__ is None:
load_dotenv()
from os import sys, path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))

Expand Down
13 changes: 7 additions & 6 deletions tests/test_us_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ def setUp(self, **kwargs):
self.mock_location = Location('Boston, MA', (42.355662,-71.065483),
{'state':'MA','zipcode':'02111'})

self.mock_location_split_parties = Location('Bakersfield, CA', (35.375960, -119.020865),
{'state':'CA','zipcode':'93301'})
# this zipcode is CA-4, a district with Republican Representative and Democratic Senator
self.mock_location_split_parties = Location('South Lake Tahoe, CA', (38.939391, -119.977879),
{'state':'CA','zipcode':'96150'})

# this zipcode pretty evenly split between KY-2 & TN-7
self.mock_location_multiple_states = Location('Fort Campbell, KY', (36.647207, -87.451635),
Expand Down Expand Up @@ -72,14 +73,14 @@ def test_district_state_lines(self):
self.assertEqual(len(districts), 2)

def test_senate(self):
senator_0 = self.us_data.get_senators('CA')[0]
senator_0 = self.us_data.get_senators('MA')[0]
self.assertEqual(senator_0['chamber'], 'senate')
self.assertEqual(senator_0['state'], 'CA')
self.assertEqual(senator_0['state'], 'MA')
self.assertGreater(len(senator_0['offices']), 1)

senator_1 = self.us_data.get_senators('CA')[1]
senator_1 = self.us_data.get_senators('MA')[1]
self.assertEqual(senator_1['chamber'], 'senate')
self.assertEqual(senator_1['state'], 'CA')
self.assertEqual(senator_1['state'], 'MA')
self.assertGreater(len(senator_1['offices']), 1)

# make sure we got two different senators...
Expand Down
4 changes: 2 additions & 2 deletions tests/test_us_state_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ def test_get_state_legid(self):
self.assertEqual(len(legids), 2)

first = self.us_data.get_state_legid(legids[0]['id'])
self.assertEqual(first['chamber'], 'upper')
self.assertEqual(first['chamber'], 'lower')

second = self.us_data.get_state_legid(legids[1]['id'])
self.assertEqual(second['chamber'], 'lower')
self.assertEqual(second['chamber'], 'upper')

def test_50_governors(self):
NO_GOV = ['AS', 'GU', 'MP', 'PR', 'VI', 'DC', '']
Expand Down

0 comments on commit 1e8abc8

Please # to comment.