Skip to content

Commit 3d5f53e

Browse files
committed
Further embrache path as list in congress, and test it.
1 parent 352eb9e commit 3d5f53e

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

sunlight/services/congress.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def locate_legislators_by_lat_lon(self, lat, lon, **kwargs):
122122
"latitude": lat,
123123
"longitude": lon
124124
})
125-
return self.get(['legislators/locate'], **kwargs)
125+
return self.get(['legislators', 'locate'], **kwargs)
126126

127127
@pageable
128128
def locate_legislators_by_zip(self, zipcode, **kwargs):
@@ -135,7 +135,7 @@ def locate_legislators_by_zip(self, zipcode, **kwargs):
135135
kwargs.update({
136136
"zip": zipcode
137137
})
138-
return self.get(['legislators/locate'], **kwargs)
138+
return self.get(['legislators', 'locate'], **kwargs)
139139

140140
@pageable
141141
def bills(self, **kwargs):
@@ -174,7 +174,7 @@ def search_bills(self, query, **kwargs):
174174
kwargs.update({
175175
"query": query
176176
})
177-
return self.get(['bills/search'], **kwargs)
177+
return self.get(['bills', 'search'], **kwargs)
178178

179179
@pageable
180180
def upcoming_bills(self, **kwargs):
@@ -201,7 +201,7 @@ def locate_districts_by_lat_lon(self, lat, lon, **kwargs):
201201
"latitude": lat,
202202
"longitude": lon
203203
})
204-
return self.get(['/districts/locate'], **kwargs)
204+
return self.get(['districts', 'locate'], **kwargs)
205205

206206
@pageable
207207
def locate_districts_by_zip(self, zipcode, **kwargs):
@@ -214,7 +214,7 @@ def locate_districts_by_zip(self, zipcode, **kwargs):
214214
kwargs.update({
215215
"zip": zipcode,
216216
})
217-
return self.get(['/districts/locate'], **kwargs)
217+
return self.get(['districts', 'locate'], **kwargs)
218218

219219
@pageable
220220
def committees(self, **kwargs):

test_sunlight.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ def test__get_url(self):
2222

2323
self.assertEqual(url, expected_url)
2424

25+
def test_pathlist__get_url(self):
26+
url = sunlight.congress._get_url(['legislators', 'locate'],
27+
sunlight.config.API_KEY)
28+
29+
expected_url = "{base_url}/legislators/locate?apikey={apikey}".format(
30+
base_url='https://congress.api.sunlightfoundation.com',
31+
apikey=sunlight.config.API_KEY)
32+
33+
self.assertEqual(url, expected_url)
34+
2535
def test_legislators(self):
2636
results = sunlight.congress.legislators()
2737
page = results._meta.get('page', None)

0 commit comments

Comments
 (0)