Skip to content

Commit

Permalink
Fix tests by updating api version to v2.
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Muehlbauer committed May 5, 2015
1 parent 16e9235 commit b0f6fd1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/test_integration/test_postgras_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TestPostgraasApi(unittest.TestCase):

def get_postgraas_by_name(self, name):
headers = {'Content-Type': 'application/json'}
list = self.app.get('/api/v1/postgraas_instances', headers=headers)
list = self.app.get('/api/v2/postgraas_instances', headers=headers)
#print list.data
for instance in json.loads(list.data):
#print instance
Expand All @@ -23,7 +23,7 @@ def get_postgraas_by_name(self, name):
def delete_instance_by_name(self, db_credentials):
id = self.get_postgraas_by_name(db_credentials["postgraas_instance_name"])
print id
print self.app.delete('/api/v1/postgraas_instances/' + str(id))
print self.app.delete('/api/v2/postgraas_instances/' + str(id))

def setUp(self):
papi.app.config['TESTING'] = True
Expand Down Expand Up @@ -53,7 +53,7 @@ def test_create_postgres_instance_api(self):
}
self.delete_instance_by_name(db_credentials)
headers = {'Content-Type': 'application/json'}
result = self.app.post('/api/v1/postgraas_instances', headers=headers, data=json.dumps(db_credentials))
result = self.app.post('/api/v2/postgraas_instances', headers=headers, data=json.dumps(db_credentials))
created_db = json.loads(result.data)
self.assertEqual(created_db["db_name"], 'test_create_postgres_instance')
self.delete_instance_by_name(db_credentials)
Expand All @@ -67,10 +67,10 @@ def test_delete_postgres_instance_api(self):
}
self.delete_instance_by_name(db_credentials)
headers = {'Content-Type': 'application/json'}
result = self.app.post('/api/v1/postgraas_instances', headers=headers, data=json.dumps(db_credentials))
result = self.app.post('/api/v2/postgraas_instances', headers=headers, data=json.dumps(db_credentials))
created_db = json.loads(result.data)
print created_db
delete_result = self.app.delete('/api/v1/postgraas_instances/' + str(created_db["postgraas_instance_id"]))
delete_result = self.app.delete('/api/v2/postgraas_instances/' + str(created_db["postgraas_instance_id"]))
deleted_db = json.loads(delete_result.data)
self.assertEqual(deleted_db["status"], 'success')
self.delete_instance_by_name(db_credentials)
Expand All @@ -95,8 +95,8 @@ def test_create_postgres_instance_name_exists(self):
}
self.delete_instance_by_name(db_credentials)
headers = {'Content-Type': 'application/json'}
first = self.app.post('/api/v1/postgraas_instances', headers=headers, data=json.dumps(db_credentials))
second = self.app.post('/api/v1/postgraas_instances', headers=headers, data=json.dumps(db_credentials))
first = self.app.post('/api/v2/postgraas_instances', headers=headers, data=json.dumps(db_credentials))
second = self.app.post('/api/v2/postgraas_instances', headers=headers, data=json.dumps(db_credentials))
print second.data
self.assertEqual(second.data, json.dumps({"msg": "postgraas_instance_name already exists my_postgraas_twice"}))
self.delete_instance_by_name(db_credentials)
Expand Down

0 comments on commit b0f6fd1

Please sign in to comment.