[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Ruby bindings test failures on Windows

From: Joe Swatosh <joe.swatosh_at_gmail.com>
Date: 2007-05-10 07:52:41 CEST

Hi

On 5/9/07, Kouhei Sutou <kou@cozmixng.org> wrote:
> Hi,
>

> I think that your patch needs to a bit works:
>
Sure. I mostly wanted a way to show what I was thinking.

> We need to learn more about auth providers...
>
!!!

> > I didn't want to start it before asking, but perhaps it would be a good idea to
> > make the assert_simple_provider() more focused and use it more like the 3rd
> > test_windows_provider test? Perhaps splitting up the other provider tests a
> > bit? As I said, it's not clear to me why the various provider tests need to
> > have the simple provider setup so often. Could be I just don't know enough.
>
> OK. Could you make a patch that describes your idea?
>

I don't remember where I was going when I wrote that, but here is where I ended
up (I created a new file that just has to the provider tests..... IOW
this is just to
talk about, if we come up with something useful I'll write a real patch.)

  Instead of returning from a test when the underlying method is not defined,
  don't define the test at all.

  I changed assert_simple_provider to assert that no matter the provider, if no
  credentials are supplied then access is denied, when credentials are supplied
  access is allowed.

  Modified the tests to use the new assert_simple_provider (don't know if it
  makes even a little sense with the keychain provider, but it works for the
  others).

This seems simpler to me. It may be too simple to be correct.

Could you please explain what the original version of
assert_simple_provider was
doing?

<code file=test_simple_providers.rb>

require "my-assertions"
require "util"

require "svn/core"
require "svn/client"

class SvnClientTest < Test::Unit::TestCase
  include SvnTestUtil

  def setup
    setup_basic(true)
  end

  def teardown
    teardown_basic
  end

  def assert_simple_provider method
    log = "sample log"
    src = "source\n"
    file = "sample.txt"
    path = File.join(@wc_path, file)
    svnserve_uri = "#{@repos_svnserve_uri}/#{file}"

    File.open(path, "w") {|f| f.print(src)}

    ctx = make_context(log)
    setup_auth_baton(ctx.auth_baton)
    ctx.add(path)
    ctx.commit(@wc_path)

    ctx = Svn::Client::Context.new
    setup_auth_baton(ctx.auth_baton)
    ctx.__send__ method
    assert_raises(Svn::Error::RaNotAuthorized) do
      ctx.cat(svnserve_uri)
    end

    ctx = Svn::Client::Context.new
    setup_auth_baton(ctx.auth_baton)
    ctx.__send__ method
    ctx.add_simple_prompt_provider(0) do |cred, realm, username, may_save|
      cred.username = @author
      cred.password = @password
    end
    assert_equal(normalize_line_break(src), ctx.cat(svnserve_uri))
  end

  def test_simple_provider
    assert_simple_provider :add_simple_provider
  end

  if Svn::Core.respond_to?(:auth_get_windows_simple_provider)
    def test_windows_simple_provider
      assert_simple_provider :add_windows_simple_provider
    end
  end

  if Svn::Core.respond_to?(:auth_get_keychain_simple_provider)
    def test_keychain_simple_provider
      assert_simple_provider :add_keychain_simple_provider
    end
  end

end

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu May 10 07:52:55 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.