assaf / rack-oauth2-server

LOOKING FOR MAINTAINER — OAuth 2.0 Authorization Server as a Rack module
http://documentup.com/assaf/rack-oauth2-server/
MIT License
231 stars 76 forks source link

Improve tests #37

Open mulderp opened 11 years ago

mulderp commented 11 years ago

Hi,

I wanted to ping whether there are needs to improve the tests for this project. Some issues/ideas:

What do you think, am I missing something, or confusing?

Thanks for feedback evt.

Patrick

assaf commented 11 years ago

What are the issues with the tests?

mulderp commented 11 years ago

I find running the tests not so easy, i.e. I was exploring how to make this project run with an SQL orm adapter (see https://github.com/mulderp/rack-oauth2-server/tree/active_record )

However, as far as I can see:

  1. It is difficult to run tests that would just concern the ORM adapter, the finest test granularity to run is e.g. with

    ruby -I . test/oauth/access_grant_test.rb -n "/using authorization code should response with sc/"

  2. The setup of a test is not clear to me, e.g. I get with my SQLLite:
  1) Error:
test: using authorization code should response with scope. (AccessGrantTest):
URI::InvalidURIError: bad URI(is not URI?):
    test/oauth/access_grant_test.rb:71:in `setup'
    /Users/pmu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run'
    /Users/pmu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:425:in `_run__1710559639028385245__setup__3451353526551626419__callbacks'
    /Users/pmu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
    /Users/pmu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks'
    /Users/pmu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/pmu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/testing/setup_and_teardown.rb:35:in `run'

It is not clear to me, where/what initial values to set here.

That is why I was thinking before taking the larger step of introducing an ActiveRecord setup, it would be interesting to me, to learn more on the test setups, evt. start with some small improvements, to get going.

mulderp commented 11 years ago

Another issue is upgrading Shoulda, since it includes a broken version of Mocha, if I see correctly :https://github.com/freerange/mocha

Versions 0.10.2, 0.10.3 & 0.11.0 of the Mocha gem were broken

assaf commented 11 years ago

I don't see where Shoulda requires Mocha.

mulderp commented 11 years ago

Hmm.. I think the problem is shoulda-matchers, requiring bourne:

shoulda-matchers (1.4.2)
  activesupport (>= 3.0.0)
  bourne (~> 1.1.2)

And bourne requires an old Mocha version. But indeed it's possible to work with it, but somehow it gave problems to my test setup. I'll check currently how to upgrade the setup.

repomaa commented 9 years ago

I forked the repo and I'm working on porting the gem for mongo 2.0. Now I'm running the tests for well over 3 hours already. This surely isn't normal, is it? The framework it's testing with is sinatra. Any ideas of how to speed up the tests?

I know that devise sets special params for the crypto in test environment. Maybe the token generation is the bottle neck. CPU usage is at 100% constantly.