From: peusterm Date: Thu, 12 May 2016 13:56:21 +0000 (+0200) Subject: made test case compatible to older requets lib X-Git-Tag: v3.1~126^2~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=dd59d0dd8dba546271267296b88447a2251aa4f5;p=osm%2Fvim-emu.git made test case compatible to older requets lib --- diff --git a/src/emuvim/test/unittests/test_sonata_dummy_gatekeeper.py b/src/emuvim/test/unittests/test_sonata_dummy_gatekeeper.py index 02991cd..375087d 100755 --- a/src/emuvim/test/unittests/test_sonata_dummy_gatekeeper.py +++ b/src/emuvim/test/unittests/test_sonata_dummy_gatekeeper.py @@ -1,6 +1,6 @@ import time import requests -import subprocess +import json import os import unittest from emuvim.test.base import SimpleTestTopology @@ -33,10 +33,10 @@ class testSonataDummyGatekeeper(SimpleTestTopology): files = {"package": open(PACKAGE_PATH, "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) + self.assertTrue(json.loads(r.text).get("service_uuid") is not None) # instantiate service - service_uuid = r.json().get("service_uuid") + service_uuid = json.loads(r.text).get("service_uuid") r2 = requests.post("http://127.0.0.1:5000/instantiations", json={"service_uuid": service_uuid}) self.assertEqual(r2.status_code, 200) @@ -45,9 +45,9 @@ class testSonataDummyGatekeeper(SimpleTestTopology): # check get request APIs r3 = requests.get("http://127.0.0.1:5000/packages") - self.assertEqual(len(r3.json().get("service_uuid_list")), 1) + self.assertEqual(len(json.loads(r3.text).get("service_uuid_list")), 1) r4 = requests.get("http://127.0.0.1:5000/instantiations") - self.assertEqual(len(r4.json().get("service_instance_list")), 1) + self.assertEqual(len(json.loads(r4.text).get("service_instance_list")), 1) # check number of running nodes self.assertTrue(len(self.getContainernetContainers()) == 3) diff --git a/utils/docker/Dockerfile b/utils/docker/Dockerfile index 18e8bfe..27157d8 100755 --- a/utils/docker/Dockerfile +++ b/utils/docker/Dockerfile @@ -11,6 +11,8 @@ RUN cd /son-emu/ansible \ && cd /son-emu \ # we need to reset the __pycache__ for correct test discovery && rm -rf src/emuvim/test/__pycache__ \ + && rm -rf src/emuvim/test/unittests/__pycache__ \ + && rm -rf src/emuvim/test/integrationtests/__pycache__ \ && python setup.py install \ && echo 'Done'