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()
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)
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
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)
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)
def setUp(self): super(CreateLeaseTestCase, self).setUp() self.cl = leases.CreateLease(shell.BlazarShell(), mock.Mock())
def setUp(self): super(CreateHostTest, self).setUp() self.create_host = hosts.CreateHost(shell.BlazarShell(), mock.Mock())
def setUp(self): super(BlazarShellTestCase, self).setUp() #Create shell for non-specific tests self.blazar_shell = shell.BlazarShell()
def setUp(self): super(CreateFloatingIPTest, self).setUp() self.create_floatingip = floatingips.CreateFloatingIP( shell.BlazarShell(), mock.Mock())