Ejemplo n.º 1
0
    def test_establish_rest_session(self):
        """Test establish REST session."""
        ref_headers = {
            'content-type': 'application/json',
            'accept': 'application/json',
            'application-type': 'test_app',
            'user-agent': self.ua_details
        }
        temp_rest = rest_requests.RestRequests(
            username='******',
            password='******',
            verify=False,
            base_url='http://10.10.10.10:8443/univmax/restapi',
            interval=1,
            retries=3,
            application_type='test_app')

        self.assertEqual(ref_headers, temp_rest.session.headers)
        self.assertEqual('smc', temp_rest.session.auth.username)
        self.assertEqual('smc', temp_rest.session.auth.password)
        self.assertEqual(False, temp_rest.session.verify)
Ejemplo n.º 2
0
 def setUp(self):
     """Setup."""
     super(PyU4VRestRequestsTest, self).setUp()
     self.data = pcd.CommonData()
     pyu4v_version = constants.PYU4V_VERSION
     python_version = platform.python_version()
     sys_platform = platform.system()
     sys_platform_release = platform.release()
     self.ua_details = (
         'PyU4V/{pv} ({plat}; version {rel}) Python {python}'.format(
             pv=pyu4v_version,
             plat=sys_platform,
             rel=sys_platform_release,
             python=python_version))
     self.rest = rest_requests.RestRequests(
         username='******',
         password='******',
         verify=False,
         base_url='http://10.10.10.10:8443/univmax/restapi',
         interval=1,
         retries=3,
         application_type='pyu4v')