Skip to content

Commit 1e8abc8

Browse files
committed
update tests
update split_parties location test_senate using MA, not CA travis-ci move from .org to .com
1 parent a641ad7 commit 1e8abc8

File tree

6 files changed

+19
-11
lines changed

6 files changed

+19
-11
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ python:
33
- "3.7"
44
install: "pip install -r requirements/development.txt"
55
cache: pip
6-
script: pytest -m "not slow" --cov=call_server/
6+
script: py.test -m "not slow" --cov=call_server/
77
after_sucess:
88
coveralls

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ This application should be easy to host on Heroku, with Docker, or directly on a
5252

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

55-
[![Build Status](https://travis-ci.org/OpenSourceActivismTech/call-power.svg?branch=master)](https://travis-ci.org/OpenSourceActivismTech/call-power)
55+
Testing
56+
-------
57+
`python tests/run.py`
58+
59+
[![Build Status](https://travis-ci.com/OpenSourceActivismTech/call-power.svg?branch=master)](https://travis-ci.com/OpenSourceActivismTech/call-power)
5660
[![Coverage Status](https://coveralls.io/repos/github/OpenSourceActivismTech/call-power/badge.svg?branch=master)](https://coveralls.io/github/OpenSourceActivismTech/call-power?branch=master)
5761

5862
Political Data

requirements/development.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ cssmin==0.2.0
77
coverage==4.4
88
coveralls==1.1
99
pip-upgrade
10-
pytest-cov==2.10.1
10+
pytest-cov==2.10.1
11+
pytest-dotenv==0.5.2

tests/run.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import pytest
2+
from dotenv import load_dotenv
23

34
from flask_testing import TestCase
45

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

tests/test_us_data.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ def setUp(self, **kwargs):
3939
self.mock_location = Location('Boston, MA', (42.355662,-71.065483),
4040
{'state':'MA','zipcode':'02111'})
4141

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

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

7475
def test_senate(self):
75-
senator_0 = self.us_data.get_senators('CA')[0]
76+
senator_0 = self.us_data.get_senators('MA')[0]
7677
self.assertEqual(senator_0['chamber'], 'senate')
77-
self.assertEqual(senator_0['state'], 'CA')
78+
self.assertEqual(senator_0['state'], 'MA')
7879
self.assertGreater(len(senator_0['offices']), 1)
7980

80-
senator_1 = self.us_data.get_senators('CA')[1]
81+
senator_1 = self.us_data.get_senators('MA')[1]
8182
self.assertEqual(senator_1['chamber'], 'senate')
82-
self.assertEqual(senator_1['state'], 'CA')
83+
self.assertEqual(senator_1['state'], 'MA')
8384
self.assertGreater(len(senator_1['offices']), 1)
8485

8586
# make sure we got two different senators...

tests/test_us_state_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ def test_get_state_legid(self):
132132
self.assertEqual(len(legids), 2)
133133

134134
first = self.us_data.get_state_legid(legids[0]['id'])
135-
self.assertEqual(first['chamber'], 'upper')
135+
self.assertEqual(first['chamber'], 'lower')
136136

137137
second = self.us_data.get_state_legid(legids[1]['id'])
138-
self.assertEqual(second['chamber'], 'lower')
138+
self.assertEqual(second['chamber'], 'upper')
139139

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

0 commit comments

Comments
 (0)