You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by ma...@gmail.com on 2012/11/24 18:06:37 UTC

[PATCH] added test for mock buckets

From: njerichelimo <ma...@gmail.com>

---
 server/tests/drivers/mock/buckets_test.rb |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 server/tests/drivers/mock/buckets_test.rb

diff --git a/server/tests/drivers/mock/buckets_test.rb b/server/tests/drivers/mock/buckets_test.rb
new file mode 100644
index 0000000..5b46aac
--- /dev/null
+++ b/server/tests/drivers/mock/buckets_test.rb
@@ -0,0 +1,18 @@
+require 'minitest/autorun'
+
+require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
+require_relative 'common.rb'
+
+describe 'MockDriver Buckets' do
+
+  before do
+    @driver = Deltacloud::new(:mock, :user => 'mockuser', :password => 'mockpassword')
+  end
+
+  it 'must throw error when wrong credentials for buckets' do
+    Proc.new do
+      @driver.backend.buckets(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
+    end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
+  end
+
+end
-- 
1.7.9.5


Re: [PATCH] added test for mock buckets

Posted by Martha Chumo <ma...@gmail.com>.
I've seen that. I'll go through the tests again. Thanks marios.

On Tue, Nov 27, 2012 at 10:44 AM, marios@redhat.com <ma...@redhat.com>wrote:

> just one comment (I only noticed this after the broken build
> -https://travis-ci.org/mifo/deltacloud/builds/3376824 ):
>
> On 24/11/12 19:06, martha.c.chumo@gmail.com wrote:
> > From: njerichelimo <ma...@gmail.com>
> >
> > ---
> >  server/tests/drivers/mock/buckets_test.rb |   18 ++++++++++++++++++
> >  1 file changed, 18 insertions(+)
> >  create mode 100644 server/tests/drivers/mock/buckets_test.rb
> >
> > diff --git a/server/tests/drivers/mock/buckets_test.rb
> b/server/tests/drivers/mock/buckets_test.rb
> > new file mode 100644
> > index 0000000..5b46aac
> > --- /dev/null
> > +++ b/server/tests/drivers/mock/buckets_test.rb
> > @@ -0,0 +1,18 @@
> > +require 'minitest/autorun'
> > +
> > +require_relative File.join('..', '..', '..', 'lib', 'deltacloud',
> 'api.rb')
>
> ^^^ you don't need to do this here - because you are requiring
> 'common.rb' below - which in turn pulls in 'test_helper' that includes
> the /lib/deltacloud/api.rb
>
> The build broke because for ruby 1.8.7 we need to include
> require_relative - you'll notice this at the top of the other tests in
> mock driver directory:
>
> require 'rubygems'
> require 'require_relative' if RUBY_VERSION < '1.9'
>
> I just fixed these nits and pushed a commit - just fyi if you plan to
> add to these tests
>
>
> thanks again, marios
>
>
>
> > +require_relative 'common.rb'
> > +
> > +describe 'MockDriver Buckets' do
> > +
> > +  before do
> > +    @driver = Deltacloud::new(:mock, :user => 'mockuser', :password =>
> 'mockpassword')
> > +  end
> > +
> > +  it 'must throw error when wrong credentials for buckets' do
> > +    Proc.new do
> > +      @driver.backend.buckets(OpenStruct.new(:user => 'unknown',
> :password => 'wrong'))
> > +    end.must_raise Deltacloud::Exceptions::AuthenticationFailure,
> 'Authentication Failure'
> > +  end
> > +
> > +end
> >
>
>


-- 
{ mail : [ email : "martha.c.chumo@gmail.com" ],
  social : [ { twitter : "@NjeriChelimo" } , {facebook : "Njeri Chelimo" }
],
  code : [ { github : "Njeri Chelimo"}, { bitbucket : "nchelimo" } ],
  skype : "martha.chumo"
}

Re: [PATCH] added test for mock buckets

Posted by "marios@redhat.com" <ma...@redhat.com>.
just one comment (I only noticed this after the broken build
-https://travis-ci.org/mifo/deltacloud/builds/3376824 ):

On 24/11/12 19:06, martha.c.chumo@gmail.com wrote:
> From: njerichelimo <ma...@gmail.com>
> 
> ---
>  server/tests/drivers/mock/buckets_test.rb |   18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>  create mode 100644 server/tests/drivers/mock/buckets_test.rb
> 
> diff --git a/server/tests/drivers/mock/buckets_test.rb b/server/tests/drivers/mock/buckets_test.rb
> new file mode 100644
> index 0000000..5b46aac
> --- /dev/null
> +++ b/server/tests/drivers/mock/buckets_test.rb
> @@ -0,0 +1,18 @@
> +require 'minitest/autorun'
> +
> +require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')

^^^ you don't need to do this here - because you are requiring
'common.rb' below - which in turn pulls in 'test_helper' that includes
the /lib/deltacloud/api.rb

The build broke because for ruby 1.8.7 we need to include
require_relative - you'll notice this at the top of the other tests in
mock driver directory:

require 'rubygems'
require 'require_relative' if RUBY_VERSION < '1.9'

I just fixed these nits and pushed a commit - just fyi if you plan to
add to these tests


thanks again, marios



> +require_relative 'common.rb'
> +
> +describe 'MockDriver Buckets' do
> +
> +  before do
> +    @driver = Deltacloud::new(:mock, :user => 'mockuser', :password => 'mockpassword')
> +  end
> +
> +  it 'must throw error when wrong credentials for buckets' do
> +    Proc.new do
> +      @driver.backend.buckets(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
> +    end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
> +  end
> +
> +end
> 


Re: [PATCH] added test for mock buckets

Posted by "marios@redhat.com" <ma...@redhat.com>.
ACK

thanks! - this is a great start

marios


On 24/11/12 19:06, martha.c.chumo@gmail.com wrote:
> From: njerichelimo <ma...@gmail.com>
> 
> ---
>  server/tests/drivers/mock/buckets_test.rb |   18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>  create mode 100644 server/tests/drivers/mock/buckets_test.rb
> 
> diff --git a/server/tests/drivers/mock/buckets_test.rb b/server/tests/drivers/mock/buckets_test.rb
> new file mode 100644
> index 0000000..5b46aac
> --- /dev/null
> +++ b/server/tests/drivers/mock/buckets_test.rb
> @@ -0,0 +1,18 @@
> +require 'minitest/autorun'
> +
> +require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
> +require_relative 'common.rb'
> +
> +describe 'MockDriver Buckets' do
> +
> +  before do
> +    @driver = Deltacloud::new(:mock, :user => 'mockuser', :password => 'mockpassword')
> +  end
> +
> +  it 'must throw error when wrong credentials for buckets' do
> +    Proc.new do
> +      @driver.backend.buckets(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
> +    end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
> +  end
> +
> +end
>