[email protected] wrote: > From: Jan Provaznik <[email protected]> > > --- > src/spec/utils/repository_manager.rb | 45 ----------------------- > src/spec/utils/repository_manager_spec.rb | 55 > +++++++++++++++++++++++++++++ > 2 files changed, 55 insertions(+), 45 deletions(-) > delete mode 100644 src/spec/utils/repository_manager.rb > create mode 100644 src/spec/utils/repository_manager_spec.rb > > diff --git a/src/spec/utils/repository_manager.rb > b/src/spec/utils/repository_manager.rb > deleted file mode 100644 > index cac151c..0000000 > --- a/src/spec/utils/repository_manager.rb > +++ /dev/null > @@ -1,45 +0,0 @@ > -require 'spec_helper' > - > -describe RepositoryManager do > - before(:all) do > - @repositories_json = File.read(File.join(File.dirname(__FILE__), > - > '../fixtures/repositories.json')) > - @packagegroups_json = File.read(File.join(File.dirname(__FILE__), > - > '../fixtures/packagegroups.json')) > - @packages_json = File.read(File.join(File.dirname(__FILE__), > - '../fixtures/packages.json')) > - end > - > - before(:each) do > - hydra = Typhoeus::Hydra.hydra > - hydra.stub(:get, "http://pulptest/repositories/").and_return( > - Typhoeus::Response.new(:code => 200, :body => @repositories_json)) > - hydra.stub(:get, > "http://pulptest/repositories/jboss/packagegroups/").and_return( > - Typhoeus::Response.new(:code => 200, :body => @packagegroups_json)) > - hydra.stub(:get, > "http://pulptest/repositories/jboss/packages/").and_return( > - Typhoeus::Response.new(:code => 200, :body => @packages_json)) > - > - @rmanager = RepositoryManager.new(:config => [{ > - 'baseurl' => 'http://pulptest', > - 'yumurl' => 'http://pulptest', > - 'type' => 'pulp', > - }]) > - end > - > - it "should return a list of repositories" do > - @rmanager.repositories.should have(1).items > - @rmanager.repositories.first.id.should eql('jboss') > - end > - > - it "should return a list of packagegroups" do > - rep = @rmanager.repositories.first > - rep.groups.keys.sort.should == ["JBoss Core Packages", "JBoss Drools", > - "JBoss Social Networking Web Application"] > - end > - > - it "should return a list of packages" do > - rep = @rmanager.repositories.first > - rep.packages.map {|p| p[:name]}.sort.should == ["J-SocialNet", "JSDoc", > - "drools-guvnor", "jboss-as5", "jboss-jgroups", "jboss-rails"] > - end > -end > diff --git a/src/spec/utils/repository_manager_spec.rb > b/src/spec/utils/repository_manager_spec.rb > new file mode 100644 > index 0000000..f38c507 > --- /dev/null > +++ b/src/spec/utils/repository_manager_spec.rb > @@ -0,0 +1,55 @@ > +require 'spec_helper' > + > +describe RepositoryManager do > + before(:all) do > + @repositories_json = File.read(File.join(File.dirname(__FILE__), > + > '../fixtures/repositories.json')) > + @packagegroups_json = File.read(File.join(File.dirname(__FILE__), > + > '../fixtures/packagegroups.json')) > + @packages_json = File.read(File.join(File.dirname(__FILE__), > + '../fixtures/packages.json')) > + end > + > + before(:each) do > + hydra = Typhoeus::Hydra.hydra > + hydra.stub(:get, "http://pulptest/repositories/").and_return( > + Typhoeus::Response.new(:code => 200, :body => @repositories_json)) > + hydra.stub(:get, > "http://pulptest/repositories/jboss/packagegroups/").and_return( > + Typhoeus::Response.new(:code => 200, :body => @packagegroups_json)) > + hydra.stub(:get, > "http://pulptest/repositories/jboss/packages/").and_return( > + Typhoeus::Response.new(:code => 200, :body => @packages_json)) > + hydra.stub(:get, "http://nonexisting.repo/").and_return( > + Typhoeus::Response.new(:code => 404)) > + > + @rmanager = RepositoryManager.new(:config => [{ > + 'baseurl' => 'http://pulptest', > + 'yumurl' => 'http://pulptest', > + 'type' => 'pulp', > + }]) > + end > + > + it "should return a list of repositories" do > + @rmanager.repositories.should have(1).items > + @rmanager.repositories.first.id.should eql('jboss') > + end > + > + it "should return a list of packagegroups" do > + rep = @rmanager.repositories.first > + rep.groups.keys.sort.should == ["JBoss Core Packages", "JBoss Drools", > + "JBoss Social Networking Web Application"] > + end > + > + it "should return a list of packages" do > + rep = @rmanager.repositories.first > + rep.packages.map {|p| p[:name]}.sort.should == ["J-SocialNet", "JSDoc", > + "drools-guvnor", "jboss-as5", "jboss-jgroups", "jboss-rails"] > + end > + > + it "should raise exception when downloading of repomd fails" do > + @rmanager = RepositoryManager.new(:config => [{ > + 'baseurl' => 'http://nonexisting.repo/', > + 'type' => 'xml', > + }]) > + lambda { @rmanager.all_groups}.should raise_error > + end > +end > Ack and pushed
Scott _______________________________________________ deltacloud-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/deltacloud-devel
