whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: Add some more tests for ASF::SVN module
Date Thu, 04 Jun 2020 20:37:55 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 3f355e6  Add some more tests for ASF::SVN module
3f355e6 is described below

commit 3f355e636d1e8a11e492a1d082f244193f2b4393
Author: Sebb <sebb@apache.org>
AuthorDate: Thu Jun 4 21:37:43 2020 +0100

    Add some more tests for ASF::SVN module
---
 lib/spec/lib/svn_spec.rb | 104 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/lib/spec/lib/svn_spec.rb b/lib/spec/lib/svn_spec.rb
index 0a491a1..35d5df2 100644
--- a/lib/spec/lib/svn_spec.rb
+++ b/lib/spec/lib/svn_spec.rb
@@ -109,4 +109,108 @@ describe ASF::SVN do
   
   end
 
+  describe "ASF:SVN.private_public" do
+    it "should return an array of size 2" do
+      res = ASF::SVN.private_public
+      expect(res.size()).to equal(2)
+      expect(res[0].size).to equal(15) # will need to be adjusted from time to time
+      expect(res[1].size).to equal(11) # ditto.
+    end
+  end
+
+  describe "ASF:SVN.getInfo(repo)" do
+    it "getInfo(public workspace) should return a string at least 30 chars long starting
with 'Path: '" do
+      pub = ASF::SVN.private_public()[1]
+      repo = ASF::SVN[pub[1]] # select a public repo
+      out, err = ASF::SVN.getInfo(repo)
+      expect(err).to eq(nil)
+      expect(out.size).to be > 30
+      expect(out).to start_with("Path: ")
+    end
+
+    it "getInfo(private workspace) should return a string at least 30 chars long starting
with 'Path: '" do
+      prv = ASF::SVN.private_public()[0]
+      repo = ASF::SVN[prv[1]] # select a private repo
+      out, err = ASF::SVN.getInfo(repo)
+      expect(err).to eq(nil)
+      expect(out.size).to be > 30
+      expect(out).to start_with("Path: ")
+    end
+
+    it "getInfo(public url) should return a string at least 30 chars long starting with 'Path:
'" do
+      pub = ASF::SVN.private_public()[1]
+      repo = ASF::SVN.svnurl(pub[1]) # select a public repo url
+      expect(repo).to start_with("https://")
+      out, err = ASF::SVN.getInfo(repo)
+      expect(err).to eq(nil)
+      expect(out.size).to be > 30
+      expect(out).to start_with("Path: ")
+    end
+
+# How to ensure local SVN cached auth is not used?    
+#    it "getInfo(private url) should return a string at least 30 chars long starting with
'Path: '" do
+#      prv = ASF::SVN.private_public()[0]
+#      repo = ASF::SVN.svnurl(prv[1]) # select a private repo
+#      expect(repo).to start_with("https://")
+#      out, err = ASF::SVN.getInfo(repo)
+#      expect(err).to eq(nil)
+#      expect(out.size).to be > 30
+#      expect(out).to start_with("Path: ")
+#    end
+
+  end
+
+  describe "ASF:SVN.getInfoItem" do
+    it "getInfoItem(public checkout,'url') should return the URL" do
+      pub = ASF::SVN.private_public()[1]
+      repo = ASF::SVN[pub[1]] # select a public repo
+      out, err = ASF::SVN.getInfoItem(repo,'url')
+      expect(err).to eq(nil)
+      expect(out).to eq(ASF::SVN.svnurl(pub[1]))
+    end
+
+    it "getInfoItem(public url,'url') should return the URL" do
+      pub = ASF::SVN.private_public()[1]
+      repo = ASF::SVN.svnurl(pub[1]) # select a public repo URL
+      out, err = ASF::SVN.getInfoItem(repo,'url')
+      expect(err).to eq(nil)
+      expect(out).to eq(ASF::SVN.svnurl(pub[1]))
+    end
+  end
+
+  describe "ASF:SVN.list" do
+    it "list(public checkout,'url') should return a list" do
+      pub = ASF::SVN.private_public()[1]
+      repo = ASF::SVN[pub[1]] # select a public repo
+      out, err = ASF::SVN.list(repo)
+      expect(err).to eq(nil)
+      expect(out.size).to be > 10 # need a better test
+    end
+  
+    it "list(public url,'url') should return a list" do
+      pub = ASF::SVN.private_public()[1]
+      repo = ASF::SVN.svnurl(pub[1]) # select a public repo URL
+      out, err = ASF::SVN.list(repo)
+      expect(err).to eq(nil)
+      expect(out.size).to be > 10 # need a better test
+    end
+  end
+
+  describe "ASF:SVN.get" do
+    it "get(public checkout,'_template.xml') should return the revision and contents" do
+      repo = File.join(ASF::SVN['attic-xdocs'],'_template.xml')
+      revision, content = ASF::SVN.get(repo)
+      expect(revision).to match(/\d+/)
+      expect(content.size).to be > 1000 # need a better test
+    end
+  
+    it "get(public url,'_template.xml') should return the revision and contents" do
+      repo = File.join(ASF::SVN.svnurl('attic-xdocs'),'_template.xml')
+      revision, content = ASF::SVN.get(repo)
+      expect(revision).to match(/\d+/)
+      expect(content.size).to be > 1000 # need a better test
+    end
+  end
+    
+      
 end
\ No newline at end of file


Mime
View raw message