Permalink
Browse files

Added test for site-versioning functionality

  • Loading branch information...
1 parent 69e3bcd commit 6b40269d84621376cfe32dbb13416bfbca05878a @codders committed Sep 10, 2009
@@ -7,20 +7,22 @@
include SlingUsers
if $ARGV.size < 1
- puts "Usage: create_site.rb PATH [site groups...]"
+ puts "Usage: create_site.rb PATH [TEMPLATE [site groups...]]"
exit 1
end
path = $ARGV[0]
+template = $ARGV[1]
@s = Sling.new()
@sm = SiteManager.new(@s)
@um = UserManager.new(@s)
-site = @sm.create_site("sites", "Site #{path}", path)
+site = @sm.create_site("sites", "Site #{path}", path, template)
puts "Site created... making joinable"
site.set_joinable("yes")
-if ($ARGV.size > 1)
+if ($ARGV.size > 2)
groups = $ARGV
groups.shift
+ groups.shift
groups.each do |groupname|
puts "Creating group #{groupname}"
group = @um.create_group(groupname)
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+
+require 'sling/test'
+require 'sling/search'
+require 'test/unit.rb'
+require 'test/unit/ui/console/testrunner.rb'
+include SlingSearch
+
+class TC_Kern325Test < SlingTest
+
+
+ def test_site_template_versioning
+ m = Time.now.to_i.to_s
+ template_path = "/dummy_template#{m}"
+ template_site = @sm.create_site("templates", "A Template", "#{template_path}")
+ @s.execute_post(@s.url_for(template_path), "sakai:is-site-template" => "true")
+ template = create_node("#{template_site.path}/a1#{m}", "fish" => "cat")
+ site = @sm.create_site("sites", "Site test", "/testsite#{m}", "#{template_path}")
+ versions = @s.versions(site.path)
+ assert(versions.size > 1, "Expected node '#{site.path}' to get some versions back")
+ end
+
+end
+
+Test::Unit::UI::Console::TestRunner.run(TC_Kern325Test)
+
@@ -1,6 +1,6 @@
#!/bin/sh
## ./kern-254.rb ./kern-259.rb ./kern-270.rb ###./kern-275.rb ./kern-277.rb ####./kern-278.rb ./kern-284.rb ./kern-307.rb ./kern-309.rb
-TESTS="kern-254.rb kern-259.rb kern-270.rb kern-277.rb kern-278.rb kern-284.rb kern-288.rb kern-289.rb kern-292.rb kern-307.rb kern-308.rb kern-309.rb kern-310.rb kern-312.rb"
+TESTS="kern-254.rb kern-259.rb kern-270.rb kern-277.rb kern-278.rb kern-284.rb kern-288.rb kern-289.rb kern-292.rb kern-307.rb kern-308.rb kern-309.rb kern-310.rb kern-312.rb kern-325.rb"
for i in $TESTS
do
echo $i `./$i | grep failure`
@@ -55,9 +55,9 @@ def initialize(sling)
# If posting to an existing node sitepath is ignored, if posting to sakai/site node
# sitepath is used.
- def create_site(sitecontainer, title = "Test Site", sitepath = "" )
+ def create_site(sitecontainer, title = "Test Site", sitepath = "", sitetemplate=nil )
path = @sling.url_for(sitecontainer)
- res = @sling.execute_post(path+".createsite.json", "sakai:title" => title, ":sitepath" => sitepath )
+ res = @sling.execute_post(path+".createsite.json", "sakai:title" => title, ":sitepath" => sitepath, "sakai:site-template" => sitetemplate )
if (res.code != "200" && res.code != "201")
puts "Unable to create site: #{res.code} #{res.body}"
return nil
@@ -237,7 +237,7 @@ def save_node(path)
end
def versions(path)
- return get_node_props("#{path}.versions.json")["versions"].keys
+ return get_node_props("#{path}.versions")["versions"].keys
end
def version(path, version, extension)

0 comments on commit 6b40269

Please sign in to comment.