X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=src%2Femuvim%2Ftest%2Ftest_sonata_dummy_gatekeeper.py;h=7365502097f715efb86282d40d9583e98c207b91;hb=e4a8f4ba3fa1b7fd491e43f66e79d6e03314ef96;hp=ce5bcbfdb5b262049e0e1b053acbfd69ffb5a4e4;hpb=593ca58d734362b0ddc7ca6ac23631d11f94d57e;p=osm%2Fvim-emu.git diff --git a/src/emuvim/test/test_sonata_dummy_gatekeeper.py b/src/emuvim/test/test_sonata_dummy_gatekeeper.py index ce5bcbf..7365502 100644 --- a/src/emuvim/test/test_sonata_dummy_gatekeeper.py +++ b/src/emuvim/test/test_sonata_dummy_gatekeeper.py @@ -1,5 +1,6 @@ import time import requests +import subprocess import os from emuvim.test.base import SimpleTestTopology from emuvim.api.sonata import SonataDummyGatekeeperEndpoint @@ -27,30 +28,33 @@ class testSonataDummyGatekeeper(SimpleTestTopology): # download example from GitHub print "downloading latest son-demo.son from GitHub" - download = requests.get("https://github.com/sonata-nfv/son-schema/blob/master/package-descriptor/examples/sonata-demo.son?raw=true") - with open("son-demo.son", 'wb') as f: - f.write(download.content) + subprocess.call( + ["wget", + "http://github.com/sonata-nfv/son-schema/blob/master/package-descriptor/examples/sonata-demo.son?raw=true", + "-O", + "son-demo.son"] + ) print "starting tests" # board package - files = {"file": open("son-demo.son", "rb")} - r = requests.post("http://127.0.0.1:5000/api/packages", files=files) + files = {"package": open("son-demo.son", "rb")} + r = requests.post("http://127.0.0.1:5000/packages", files=files) self.assertEqual(r.status_code, 200) self.assertTrue(r.json().get("service_uuid") is not None) os.remove("son-demo.son") # instantiate service service_uuid = r.json().get("service_uuid") - r2 = requests.post("http://127.0.0.1:5000/api/instantiations", json={"service_uuid": service_uuid}) + r2 = requests.post("http://127.0.0.1:5000/instantiations", json={"service_uuid": service_uuid}) self.assertEqual(r2.status_code, 200) # give the emulator some time to instantiate everything time.sleep(2) # check get request APIs - r3 = requests.get("http://127.0.0.1:5000/api/packages") + r3 = requests.get("http://127.0.0.1:5000/packages") self.assertEqual(len(r3.json().get("service_uuid_list")), 1) - r4 = requests.get("http://127.0.0.1:5000/api/instantiations") + r4 = requests.get("http://127.0.0.1:5000/instantiations") self.assertEqual(len(r4.json().get("service_instance_list")), 1) # check number of running nodes