[cc-commits] [SCM] license.rdf (cc.licenserdf) (branch packageify) updated. b3870763a9e5a21384c12f576fc12f3ab5169137

git version control git at a7.creativecommons.org
Thu Mar 25 11:36:30 EDT 2010


The branch, packageify has been updated
       via  b3870763a9e5a21384c12f576fc12f3ab5169137 (commit)
      from  3937b4f3108b2c6900189dfd17d5153c0c43a50b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b3870763a9e5a21384c12f576fc12f3ab5169137
Author: Christopher Allan Webber <cwebber at dustycloud.org>
Date:   Thu Mar 25 10:36:34 2010 -0500

    Add a working test for the jurisdiction launch tool.
    
    Also removed the launched=True assertion from the pl jurisdiction in
    the test RDF file.

-----------------------------------------------------------------------

Summary of changes (followed by patch):
 cc/licenserdf/tests/rdf/jurisdictions.rdf     |    1 -
 cc/licenserdf/tests/test_jurisdiction_tool.py |   33 +++++++++++++++++++++++++
 cc/licenserdf/tools/jurisdiction.py           |    2 +-
 3 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/cc/licenserdf/tests/rdf/jurisdictions.rdf b/cc/licenserdf/tests/rdf/jurisdictions.rdf
index 7b7868b..bc12d4d 100644
--- a/cc/licenserdf/tests/rdf/jurisdictions.rdf
+++ b/cc/licenserdf/tests/rdf/jurisdictions.rdf
@@ -17,7 +17,6 @@
     <dc:title xml:lang="bg">Полша</dc:title>
     <dc:title xml:lang="ja">ポーランド</dc:title>
     <dc:title xml:lang="en-us">Poland</dc:title>
-    <cc:launched rdf:datatype="http://www.w3.org/2001/XMLSchema-datatypes#boolean">true</cc:launched>
     <dc:language>pl</dc:language>
     <cc:defaultLanguage>pl</cc:defaultLanguage>
     <cc:jurisdictionSite rdf:resource="http://creativecommons.pl"/>
diff --git a/cc/licenserdf/tests/test_jurisdiction_tool.py b/cc/licenserdf/tests/test_jurisdiction_tool.py
index 4401eb6..b575007 100644
--- a/cc/licenserdf/tests/test_jurisdiction_tool.py
+++ b/cc/licenserdf/tests/test_jurisdiction_tool.py
@@ -1,6 +1,8 @@
 import copy
 import pkg_resources
 
+import rdflib
+
 from cc.licenserdf.tools import jurisdiction
 
 
@@ -13,6 +15,15 @@ class PrinterCollector(object):
     def __call__(self, string):
         self.printed_strings.append(string)
 
+class MockSaveGraph(object):
+    def __init__(self):
+        self.graph = None
+        self.save_path = None
+
+    def __call__(self, graph, save_path):
+        self.graph = graph
+        self.save_path = save_path
+
 
 EXPECTED_INFO_OUTPUT_US = [
     'http://purl.org/dc/elements/1.1/title Etats-Unis',
@@ -48,3 +59,25 @@ def test_info():
 
     jurisdiction.info(opts, printer=printer)
     _unordered_ensure_printer_printed(printer, EXPECTED_INFO_OUTPUT_US)
+
+
+def test_launch():
+    opts = MockOpts()
+    opts.rdf_file = pkg_resources.resource_filename(
+        'cc.licenserdf.tests', 'rdf/jurisdictions.rdf')
+    opts.jurisdiction = ['pl']
+
+    graph_saver = MockSaveGraph()
+
+    jurisdiction.launch(opts, save_graph=graph_saver)
+
+    result = graph_saver.graph.triples(
+        (rdflib.URIRef('http://creativecommons.org/international/pl/'),
+         rdflib.URIRef('http://creativecommons.org/ns#launched'),
+         rdflib.Literal(
+                u'true',
+                datatype=rdflib.URIRef(
+                    'http://www.w3.org/2001/XMLSchema-datatypes#boolean'))))
+
+    # assert that we got one result
+    assert len([l for l in result]) == 1
diff --git a/cc/licenserdf/tools/jurisdiction.py b/cc/licenserdf/tools/jurisdiction.py
index 7c5cbda..3d946bb 100644
--- a/cc/licenserdf/tools/jurisdiction.py
+++ b/cc/licenserdf/tools/jurisdiction.py
@@ -111,7 +111,7 @@ def info(opts, printer=_printer):
         # Maybe better output would be nice
         printer("%s %s" % (p, o))
 
-def launch(opts):
+def launch(opts, save_graph=save_graph):
     """Mark the jurisdiction as launched."""
 
     # load the RDF graph


hooks/post-receive
-- 
license.rdf (cc.licenserdf)



More information about the cc-commits mailing list