Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Commit

Permalink
Add check for new API call
Browse files Browse the repository at this point in the history
  • Loading branch information
allthatilk committed Sep 7, 2017
1 parent 30fcf01 commit 92a507b
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions iati_datastore/iatilib/test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ def test_about_http(self):
resp = self.client.get('/api/1/about')
self.assertEquals(200, resp.status_code)

class TestAboutDatasets(ClientTestCase):
def test_about_datasets_nest(self):
"""Check that the `about/datasets/nest` page has a 200 response and contains expected data."""
resp = self.client.get('/api/1/about/datasets/nest')
data = json.loads(resp.data)
self.assertEquals(200, resp.status_code)
self.assertIn("datasets", data)

class TestDeletedActivitiesView(ClientTestCase):
def test_deleted_activities(self):
db.session.add(model.DeletedActivity(
Expand All @@ -35,7 +43,7 @@ def test_deleted_activities(self):
deleted_activities = data['deleted_activities']
self.assertEquals("test", deleted_activities[0]['iati_identifier'])
self.assertEquals("2000-01-01", deleted_activities[0]['deletion_date'])


class TestEmptyDb_JSON(ClientTestCase):
url = '/api/1/access/activity'
Expand Down Expand Up @@ -341,7 +349,7 @@ def test_receiver_org_activity_id_output(self):
csv_headers = output[0]
i = csv_headers.index('transaction_receiver-org_receiver-activity-id')
self.assertEquals(u'GB-CHC-1068839-dfid_ag_11-13', output[1][i])

def test_description(self):
load_fix("transaction_provider.xml")
output = list(csv.reader(StringIO(self.client.get(self.base_url).data)))
Expand All @@ -358,14 +366,14 @@ def test_flow_type(self):
csv_headers = output[0]
i = csv_headers.index('transaction_flow-type_code')
self.assertEquals(u'30', output[1][i])

def test_finance_type(self):
load_fix("transaction_fields_code_lists.xml")
output = list(csv.reader(StringIO(self.client.get(self.base_url).data)))
csv_headers = output[0]
i = csv_headers.index('transaction_finance-type_code')
self.assertEquals(u'110', output[1][i])

def test_aid_type(self):
load_fix("transaction_fields_code_lists.xml")
output = list(csv.reader(StringIO(self.client.get(self.base_url).data)))
Expand All @@ -379,7 +387,7 @@ def test_tied_status(self):
csv_headers = output[0]
i = csv_headers.index('transaction_tied-status_code')
self.assertEquals(u'5', output[1][i])

def test_disbursement_channel_status(self):
load_fix("transaction_fields_code_lists.xml")
output = list(csv.reader(StringIO(self.client.get(self.base_url).data)))
Expand Down Expand Up @@ -421,4 +429,3 @@ class TestBudgetBySectorView(ClientTestCase, ApiViewMixin):
base_url = '/api/1/access/budget/by_sector.csv'
filter = 'iatilib.frontend.api1.BudgetsBySectorView.filter'
serializer = 'iatilib.frontend.api1.BudgetsBySectorView.serializer'

0 comments on commit 92a507b

Please sign in to comment.