コード例 #1
0
    def test_authenticate_user(self):
        obj = shell.BlazarShell()
        obj.initialize_app('list-leases')
        obj.options.os_token = 'aaaa-bbbb-cccc'
        obj.options.os_cacert = 'cert'

        obj.authenticate_user()
コード例 #2
0
    def create_delete_command(self):
        mock_lease_manager = mock.Mock()
        mock_client = mock.Mock()
        mock_client.lease = mock_lease_manager

        blazar_shell = shell.BlazarShell()
        blazar_shell.client = mock_client
        return (leases.DeleteLease(blazar_shell, mock.Mock()),
                mock_lease_manager)
コード例 #3
0
    def create_update_command(self, list_value):
        mock_host_manager = mock.Mock()
        mock_host_manager.list.return_value = list_value

        mock_client = mock.Mock()
        mock_client.host = mock_host_manager

        blazar_shell = shell.BlazarShell()
        blazar_shell.client = mock_client
        return hosts.UpdateHost(blazar_shell, mock.Mock()), mock_host_manager
コード例 #4
0
    def create_list_command(self, list_value):
        mock_floatingip_manager = mock.Mock()
        mock_floatingip_manager.list.return_value = list_value

        mock_client = mock.Mock()
        mock_client.floatingip = mock_floatingip_manager

        blazar_shell = shell.BlazarShell()
        blazar_shell.client = mock_client
        return (floatingips.ListFloatingIPs(blazar_shell, mock.Mock()),
                mock_floatingip_manager)
コード例 #5
0
 def shell(self, argstr, exitcodes=(0, )):
     orig = sys.stdout
     orig_stderr = sys.stderr
     try:
         sys.stdout = six.StringIO()
         sys.stderr = six.StringIO()
         _shell = shell.BlazarShell()
         _shell.initialize_app(argstr.split())
     except SystemExit:
         exc_type, exc_value, exc_traceback = sys.exc_info()
         self.assertIn(exc_value.code, exitcodes)
     finally:
         stdout = sys.stdout.getvalue()
         sys.stdout.close()
         sys.stdout = orig
         stderr = sys.stderr.getvalue()
         sys.stderr.close()
         sys.stderr = orig_stderr
     return (stdout, stderr)
コード例 #6
0
 def setUp(self):
     super(CreateLeaseTestCase, self).setUp()
     self.cl = leases.CreateLease(shell.BlazarShell(), mock.Mock())
コード例 #7
0
 def setUp(self):
     super(CreateHostTest, self).setUp()
     self.create_host = hosts.CreateHost(shell.BlazarShell(), mock.Mock())
コード例 #8
0
    def setUp(self):
        super(BlazarShellTestCase, self).setUp()

        #Create shell for non-specific tests
        self.blazar_shell = shell.BlazarShell()
コード例 #9
0
 def setUp(self):
     super(CreateFloatingIPTest, self).setUp()
     self.create_floatingip = floatingips.CreateFloatingIP(
         shell.BlazarShell(), mock.Mock())