Browse Source

Merge branch 'atherton' of github.com:platform9/pf9-mors into atherton

Susmitha 2 years ago
parent
commit
1e515759b3
2 changed files with 19 additions and 2 deletions
  1. 1
    1
      mors/mors_wsgi.py
  2. 18
    1
      test/test_api.py

+ 1
- 1
mors/mors_wsgi.py View File

@@ -109,7 +109,7 @@ def add_update_vm_lease(tenant_id, instance_id):
109 109
     if request.method == "POST":
110 110
         lease_manager.add_instance_lease(get_context(), tenant_id, lease_obj)
111 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 113
     return jsonify({'success': True}), 200, {'ContentType': 'application/json'}
114 114
 
115 115
 

+ 18
- 1
test/test_api.py View File

@@ -152,8 +152,25 @@ def test_get_instance():
152 152
     logger.debug(r.text)
153 153
     assert_equal(r.status_code, 200)
154 154
 
155
-
156 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 174
 def test_deleted_instance():
158 175
     eventlet.greenthread.sleep(50)
159 176
     # The instance lease should be deleted by now

Loading…
Cancel
Save