コード例 #1
0
 def test_timeout_error(self):
     cmd = NaviCommand()
     start = time.time()
     cmd.execute('python'.split(), timeout=0.1)
     dt = time.time() - start
     assert_that(dt, less_than(1))
コード例 #2
0
 def test_security_level_low(self):
     cmd = NaviCommand()
     assert_that(cmd.get_security_level('naviseccli'), equal_to('low'))
コード例 #3
0
 def test_error_credentials(self):
     cmd = NaviCommand('a')
     assert_that(cmd.is_credential_valid, equal_to(True))
     assert_that(cmd.get_credentials, raises(VNXCredentialError, 'missing'))
     assert_that(cmd.is_credential_valid, equal_to(False))
コード例 #4
0
 def test_sec_file_empty_string(self):
     cmd = NaviCommand('a', 'a', 1, '', timeout=20)
     assert_that(' '.join(map(str, cmd.get_credentials())),
                 equal_to('-user a -password a -scope 1 -t 20'))
コード例 #5
0
 def test_timeout_max_and_min(self):
     cmd = NaviCommand()
     cmd._timeout = 0.5
     assert_that(cmd.timeout, equal_to(cmd.MIN_TIMEOUT))
     cmd._timeout = 10**10
     assert_that(cmd.timeout, equal_to(cmd.MAX_TIMEOUT))
コード例 #6
0
 def test_security_file_precedence(self):
     cmd = NaviCommand(sec_file=r'/a/b/c.key',
                       username='******',
                       password='')
     assert_that(' '.join(cmd.get_credentials()),
                 equal_to('-secfilepath /a/b/c.key'))
コード例 #7
0
 def test_username_password_timeout(self):
     cmd = NaviCommand('a', 'a', 1, timeout=20)
     assert_that(' '.join(map(str, cmd.get_credentials())),
                 equal_to('-user a -password a -scope 1 -t 20'))
コード例 #8
0
 def test_default_security_file(self):
     cmd = NaviCommand()
     assert_that(cmd.get_credentials(), equal_to([]))
コード例 #9
0
 def test_security_file(self):
     cmd = NaviCommand(sec_file=r'/a/b/c.key')
     assert_that(' '.join(cmd.get_credentials()),
                 equal_to('-secfilepath /a/b/c.key'))
コード例 #10
0
 def test_security_level_low(self):
     cmd = NaviCommand()
     assert_that(cmd.get_security_level('naviseccli'), equal_to('low'))
コード例 #11
0
 def test_timeout_max_and_min(self):
     cmd = NaviCommand()
     cmd._timeout = 0.5
     assert_that(cmd.timeout, equal_to(cmd.MIN_TIMEOUT))
     cmd._timeout = 10 ** 10
     assert_that(cmd.timeout, equal_to(cmd.MAX_TIMEOUT))
コード例 #12
0
 def test_username_password_timeout(self):
     cmd = NaviCommand('a', 'a', 1, timeout=20)
     assert_that(' '.join(map(str, cmd.get_credentials())),
                 equal_to('-user a -password a -scope 1 -t 20'))
コード例 #13
0
 def test_security_file(self):
     cmd = NaviCommand(sec_file=r'/a/b/c.key')
     assert_that(' '.join(cmd.get_credentials()),
                 equal_to('-secfilepath /a/b/c.key'))
コード例 #14
0
 def test_default_security_file(self):
     cmd = NaviCommand()
     assert_that(cmd.get_credentials(), equal_to([]))