summaryrefslogtreecommitdiffstats
path: root/lcm
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2017-09-28 16:49:11 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2017-09-28 16:49:11 +0800
commita1033338e24dbe2f243f23461e615c708f4cdcab (patch)
treea8ad1f2e8fe41d1fbc0092cdfd434f7c2bc6537d /lcm
parente97e0b12f8aa84d136e619902c95303333fb3a6c (diff)
Fix vnflcm samples pep8 error
Change-Id: I8ea9ea41925ade445c92ab3402575a97d9aeb000 Issue-Id: VFC-469 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
Diffstat (limited to 'lcm')
-rw-r--r--lcm/lcm/samples/resources.py7
-rw-r--r--lcm/lcm/samples/tests.py7
-rw-r--r--lcm/lcm/samples/views.py1
3 files changed, 7 insertions, 8 deletions
diff --git a/lcm/lcm/samples/resources.py b/lcm/lcm/samples/resources.py
index 2a4fa4ec..700fcb86 100644
--- a/lcm/lcm/samples/resources.py
+++ b/lcm/lcm/samples/resources.py
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import json
import logging
import threading
import traceback
@@ -22,6 +21,7 @@ from lcm.pub.vimapi import adaptor
logger = logging.getLogger(__name__)
+
class ResCreateThread(threading.Thread):
"""
Create resource
@@ -36,10 +36,11 @@ class ResCreateThread(threading.Thread):
except:
logger.error(traceback.format_exc())
logger.error(str(sys.exc_info()))
-
+
def do_notify(self, res_type, ret):
logger.debug('ret of [%s] is %s', res_type, ret)
+
class ResDeleteThread(threading.Thread):
"""
Delete resource
@@ -54,6 +55,6 @@ class ResDeleteThread(threading.Thread):
except:
logger.error(traceback.format_exc())
logger.error(str(sys.exc_info()))
-
+
def do_notify(self, res_type, res_id):
logger.debug('Delete %s(%s)', res_type, res_id)
diff --git a/lcm/lcm/samples/tests.py b/lcm/lcm/samples/tests.py
index 78fda054..efb5b108 100644
--- a/lcm/lcm/samples/tests.py
+++ b/lcm/lcm/samples/tests.py
@@ -14,12 +14,9 @@
import unittest
import json
-import mock
from django.test import Client
from rest_framework import status
-from lcm.pub.vimapi import api
-
inst_res_url = "/api/vnflcm/v1/resources/inst"
term_res_url = "/api/vnflcm/v1/resources/term"
inst_res_data = {
@@ -243,6 +240,7 @@ term_res_data = {
"vm": [{"vim_id": "6", "tenant_id": "7", "res_id": "8"}]
}
+
class SampleViewTest(unittest.TestCase):
def setUp(self):
self.client = Client()
@@ -255,7 +253,7 @@ class SampleViewTest(unittest.TestCase):
self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
resp_data = json.loads(response.content)
self.assertEqual({"status": "active"}, resp_data)
-
+
def test_inst_res(self):
resp = self.client.post(inst_res_url, data=json.dumps(inst_res_data), content_type='application/json')
self.failUnlessEqual(status.HTTP_204_NO_CONTENT, resp.status_code)
@@ -263,4 +261,3 @@ class SampleViewTest(unittest.TestCase):
def test_term_res(self):
resp = self.client.post(term_res_url, data=json.dumps(term_res_data), content_type='application/json')
self.failUnlessEqual(status.HTTP_204_NO_CONTENT, resp.status_code)
- \ No newline at end of file
diff --git a/lcm/lcm/samples/views.py b/lcm/lcm/samples/views.py
index 41c8714c..7ff15500 100644
--- a/lcm/lcm/samples/views.py
+++ b/lcm/lcm/samples/views.py
@@ -30,6 +30,7 @@ class SampleList(APIView):
logger.debug("get")
return Response({"status": "active"})
+
class ResourceList(APIView):
"""
Instantiate/Terminate resource.