diff options
author | Susmitha <susmitha@platform9.com> | 2016-06-07 11:57:37 -0700 |
---|---|---|
committer | Susmitha <susmitha@platform9.com> | 2016-06-07 11:57:37 -0700 |
commit | 1e515759b3c4f6f3a84f459d11903c839f7fb8ae (patch) | |
tree | ca807acb675dffc396f1d67385876eba95242f3d | |
parent | 49c5977a4a7f6a77fe238c4b43c0ecb52ca0ec8b (diff) | |
parent | e1b921999e767a3a7fa9e6c1050232c2a126f56b (diff) |
Merge branch 'atherton' of github.com:platform9/pf9-mors into atherton
-rw-r--r-- | mors/mors_wsgi.py | 2 | ||||
-rw-r--r-- | test/test_api.py | 19 |
2 files changed, 19 insertions, 2 deletions
diff --git a/mors/mors_wsgi.py b/mors/mors_wsgi.py index 35a1ce5..9ffe460 100644 --- a/mors/mors_wsgi.py +++ b/mors/mors_wsgi.py | |||
@@ -109,7 +109,7 @@ def add_update_vm_lease(tenant_id, instance_id): | |||
109 | if request.method == "POST": | 109 | if request.method == "POST": |
110 | lease_manager.add_instance_lease(get_context(), tenant_id, lease_obj) | 110 | lease_manager.add_instance_lease(get_context(), tenant_id, lease_obj) |
111 | else: | 111 | else: |
112 | lease_manager.update_tenant_lease(get_context(), tenant_id, lease_obj) | 112 | lease_manager.update_instance_lease(get_context(), tenant_id, lease_obj) |
113 | return jsonify({'success': True}), 200, {'ContentType': 'application/json'} | 113 | return jsonify({'success': True}), 200, {'ContentType': 'application/json'} |
114 | 114 | ||
115 | 115 | ||
diff --git a/test/test_api.py b/test/test_api.py index ccd8749..277e29d 100644 --- a/test/test_api.py +++ b/test/test_api.py | |||
@@ -152,8 +152,25 @@ def test_get_instance(): | |||
152 | logger.debug(r.text) | 152 | logger.debug(r.text) |
153 | assert_equal(r.status_code, 200) | 153 | assert_equal(r.status_code, 200) |
154 | 154 | ||
155 | |||
156 | @test(depends_on=[test_get_instance]) | 155 | @test(depends_on=[test_get_instance]) |
156 | def test_update_instance(): | ||
157 | expiry = datetime.utcnow() | ||
158 | expiry_str = datetime.strftime(expiry, DATE_FORMAT) | ||
159 | r = requests.put('http://127.0.0.1:' + port + '/v1/tenant/' + tenant_id1 + '/instance/' + instance_id1, | ||
160 | json={"instance_uuid": instance_id1, "expiry": expiry_str}, | ||
161 | headers=headers) | ||
162 | logger.debug(r.text) | ||
163 | assert_equal(r.status_code, 200) | ||
164 | |||
165 | @test(depends_on=[test_update_instance]) | ||
166 | def test_get_instance2(): | ||
167 | r = requests.get('http://127.0.0.1:' + port + '/v1/tenant/' + tenant_id1 + '/instance/' + instance_id1, | ||
168 | headers=headers) | ||
169 | logger.debug(r.text) | ||
170 | assert_equal(r.status_code, 200) | ||
171 | |||
172 | |||
173 | @test(depends_on=[test_get_instance2]) | ||
157 | def test_deleted_instance(): | 174 | def test_deleted_instance(): |
158 | eventlet.greenthread.sleep(50) | 175 | eventlet.greenthread.sleep(50) |
159 | # The instance lease should be deleted by now | 176 | # The instance lease should be deleted by now |