Fix security issues of eval-s in testapi
[releng.git] / utils / test / result_collection_api / opnfv_testapi / tests / unit / test_dashboard.py
index 16a3140..27ec763 100644 (file)
@@ -1,9 +1,16 @@
+##############################################################################
+# Copyright (c) 2016 ZTE Corporation
+# feng.xiaowei@zte.com.cn
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
 import unittest
 
-from test_result import TestResultBase
 from opnfv_testapi.common.constants import HTTP_NOT_FOUND, HTTP_OK
 
-__author__ = '__serena__'
+from test_result import TestResultBase
 
 
 class TestDashboardBase(TestResultBase):
@@ -57,7 +64,7 @@ class TestDashboardQuery(TestDashboardBase):
             if k == 'self' or k == 'uri':
                 continue
             if v is None:
-                v = eval('self.' + k)
+                v = self.__getattribute__(k)
             if v != 'missing':
                 uri += '{}={}&'.format(k, v)
         uri += 'pod={}&'.format(self.pod)