def create_context(context_name, cloud_name, use_later=False): try: ctx.create_context(context_name, cloud_name) except ctx.ContextExistsException as e: raise CLIError(e) except CloudNotRegisteredException as e: raise CLIError(e) if not use_later: ctx.set_active_context(context_name)
def activate_context(context_name): try: ctx.set_active_context(context_name) except ctx.ContextNotFoundException as e: raise CLIError(e)
def test_set_active_context_not_exists(self): context_name = 'mynewcontext' # We haven't created the context yet so it doesn't exist with self.assertRaises(ContextNotFoundException): set_active_context(context_name, skip_set_active_subsciption=True)