コード例 #1
0
 def test_LoginRequest_requestargs(self):
     expected = {
         'headers': {
             'Cookie': 'APIC-cookie=None'
         },
         'allow_redirects': False,
         'data': '{"aaaUser": {"attributes": ' +
         '{"name": "admin", "pwd": "password"}}}',
         'timeout': 90,
         'verify': False
     }
     session = LoginSession('http://1.1.1.1', 'admin', 'password')
     lr = LoginRequest('admin', 'password')
     assert lr.requestargs(session) == expected
コード例 #2
0
ファイル: test_request.py プロジェクト: bischatt78/cobra
 def test_LoginRequest_requestargs(self):
     expected = {
                    'headers': {
                        'Cookie': 'APIC-cookie=None'
                     },
                     'allow_redirects': False,
                     'data': '{"aaaUser": {"attributes": ' +
                             '{"name": "admin", "pwd": "password"}}}',
                     'timeout': 90,
                     'verify': False
                }
     session = LoginSession('http://1.1.1.1', 'admin', 'password')
     lr = LoginRequest('admin', 'password')
     assert lr.requestargs(session) == expected
コード例 #3
0
 def test_LoginRequest_individual_properties(self, user, password, prop):
     lr = LoginRequest(user, password)
     if prop == 'user':
         assert lr.user == user
     elif prop == 'password':
         assert lr.password == password
     else:
         raise NotImplementedError("Unexpected property name")
コード例 #4
0
    def login(self):
        """Login in to the remote server (APIC or Fabric Node).

        Raises:
          LoginError: If there was an error during login or the response could
            not be parsed.
        """
        loginRequest = LoginRequest(self.user, self.password)
        try:
            rsp = self._accessimpl.post(loginRequest)
        except RestError as ex:
            self._parseResponse(ex.reason)
        self._parseResponse(rsp)
コード例 #5
0
 def test_LoginRequest_getUrl(self, sessionUrl):
     session = LoginSession(sessionUrl, 'admin', 'password')
     expected = sessionUrl + '/api/aaaLogin.json'
     lr = LoginRequest('admin', 'password')
     assert lr.getUrl(session) == expected
コード例 #6
0
 def test_LoginRequest_init(self):
     assert isinstance(LoginRequest('user', 'password'), LoginRequest)
コード例 #7
0
ファイル: test_request.py プロジェクト: bischatt78/cobra
 def test_LoginRequest_getUrl(self, sessionUrl):
     session = LoginSession(sessionUrl, 'admin', 'password')
     expected = sessionUrl + '/api/aaaLogin.json'
     lr = LoginRequest('admin', 'password')
     assert lr.getUrl(session) == expected