Exemplo n.º 1
0
Arquivo: pool.py Projeto: pirapu/raj
  def test_assert_valid(self):
    """Test assert_valid method on proxy objects"""

    # Test assert_valid with destroy()
    client_ctx = svn.client.svn_client_create_context()
    config = svn.core.svn_config_get_config(None)
    wrapped_config = GenericSWIGWrapper(config, config._parent_pool)
    client_ctx.config = config
    config.assert_valid()
    wrapped_config.assert_valid()
    client_ctx.config.assert_valid()
    config._parent_pool.destroy()
    self.assertRaises(AssertionError, lambda: config.assert_valid())
    self.assertRaises(AssertionError, lambda: wrapped_config.assert_valid())
    self.assertRaises(AssertionError, lambda: client_ctx.config)
    
    # Test assert_valid with clear()
    client_ctx = svn.client.svn_client_create_context()
    config = svn.core.svn_config_get_config(None)
    wrapped_config = GenericSWIGWrapper(config, config._parent_pool)
    client_ctx.config = config
    config.assert_valid()
    client_ctx.config.assert_valid()
    wrapped_config.assert_valid()
    config._parent_pool.clear()
    self.assertRaises(AssertionError, lambda: config.assert_valid())
    self.assertRaises(AssertionError, lambda: wrapped_config.assert_valid())
    self.assertRaises(AssertionError, lambda: client_ctx.config)
Exemplo n.º 2
0
    def test_assert_valid(self):
        """Test assert_valid method on proxy objects"""

        # Test assert_valid with destroy()
        client_ctx = svn.client.svn_client_create_context()
        auth = svn.core.svn_auth_open([])
        wrapped_auth = GenericSWIGWrapper(auth, auth._parent_pool)
        client_ctx.auth_baton = auth
        auth.assert_valid()
        wrapped_auth.assert_valid()
        client_ctx.auth_baton.assert_valid()
        auth._parent_pool.destroy()
        self.assertRaises(AssertionError, lambda: auth.assert_valid())
        self.assertRaises(AssertionError, lambda: wrapped_auth.assert_valid())
        self.assertRaises(AssertionError, lambda: client_ctx.auth_baton)

        # Test assert_valid with clear()
        client_ctx = svn.client.svn_client_create_context()
        auth = svn.core.svn_auth_open([])
        wrapped_auth = GenericSWIGWrapper(auth, auth._parent_pool)
        client_ctx.auth_baton = auth
        auth.assert_valid()
        wrapped_auth.assert_valid()
        client_ctx.auth_baton.assert_valid()
        auth._parent_pool.clear()
        self.assertRaises(AssertionError, lambda: auth.assert_valid())
        self.assertRaises(AssertionError, lambda: wrapped_auth.assert_valid())
        self.assertRaises(AssertionError, lambda: client_ctx.auth_baton)
Exemplo n.º 3
0
    def test_assert_valid(self):
        """Test assert_valid method on proxy objects"""

        # Test assert_valid with destroy()
        client_ctx = svn.client.svn_client_create_context()
        config = svn.core.svn_config_get_config(None)
        wrapped_config = GenericSWIGWrapper(config, config._parent_pool)
        client_ctx.config = config
        config.assert_valid()
        wrapped_config.assert_valid()
        client_ctx.config.assert_valid()
        config._parent_pool.destroy()
        self.assertRaises(AssertionError, lambda: config.assert_valid())
        self.assertRaises(AssertionError, lambda: wrapped_config.assert_valid())
        self.assertRaises(AssertionError, lambda: client_ctx.config)

        # Test assert_valid with clear()
        client_ctx = svn.client.svn_client_create_context()
        config = svn.core.svn_config_get_config(None)
        wrapped_config = GenericSWIGWrapper(config, config._parent_pool)
        client_ctx.config = config
        config.assert_valid()
        client_ctx.config.assert_valid()
        wrapped_config.assert_valid()
        config._parent_pool.clear()
        self.assertRaises(AssertionError, lambda: config.assert_valid())
        self.assertRaises(AssertionError, lambda: wrapped_config.assert_valid())
        self.assertRaises(AssertionError, lambda: client_ctx.config)
Exemplo n.º 4
0
  def test_assert_valid(self):
    """Test assert_valid method on proxy objects"""

    # Test assert_valid with destroy()
    client_ctx = svn.client.svn_client_create_context()
    auth = svn.core.svn_auth_open([])
    wrapped_auth = GenericSWIGWrapper(auth, auth._parent_pool)
    client_ctx.auth_baton = auth
    auth.assert_valid()
    wrapped_auth.assert_valid()
    client_ctx.auth_baton.assert_valid()
    auth._parent_pool.destroy()
    self.assertRaises(AssertionError, lambda: auth.assert_valid())
    self.assertRaises(AssertionError, lambda: wrapped_auth.assert_valid())
    self.assertRaises(AssertionError, lambda: client_ctx.auth_baton)

    # Test assert_valid with clear()
    client_ctx = svn.client.svn_client_create_context()
    auth = svn.core.svn_auth_open([])
    wrapped_auth = GenericSWIGWrapper(auth, auth._parent_pool)
    client_ctx.auth_baton = auth
    auth.assert_valid()
    wrapped_auth.assert_valid()
    client_ctx.auth_baton.assert_valid()
    auth._parent_pool.clear()
    self.assertRaises(AssertionError, lambda: auth.assert_valid())
    self.assertRaises(AssertionError, lambda: wrapped_auth.assert_valid())
    self.assertRaises(AssertionError, lambda: client_ctx.auth_baton)