From 4a9ee94e8e29edc201358ddea69b6ffe56f01266 Mon Sep 17 00:00:00 2001 From: peusterm Date: Wed, 23 Mar 2016 21:28:24 +0100 Subject: [PATCH] Use automatically downloaded example package from github for tests. --- src/emuvim/test/test_sonata_dummy_gatekeeper.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/emuvim/test/test_sonata_dummy_gatekeeper.py b/src/emuvim/test/test_sonata_dummy_gatekeeper.py index b2bd36e..b7ba371 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 os from emuvim.test.base import SimpleTestTopology from emuvim.api.sonata import SonataDummyGatekeeperEndpoint @@ -24,13 +25,19 @@ class testSonataDummyGatekeeper(SimpleTestTopology): self.startNet() time.sleep(1) - # TODO download original son package + # 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) + print "starting tests" # board package - files = {"file": open("/home/manuel/Desktop/sonata-demo.son", "rb")} + files = {"file": open("son-demo.son", "rb")} r = requests.post("http://127.0.0.1:5000/api/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") -- 2.25.1