--- a/src/tests/cli/t_pkg_temp_sources.py Wed Jun 27 10:07:32 2012 +1200
+++ b/src/tests/cli/t_pkg_temp_sources.py Wed Jun 27 14:26:00 2012 -0700
@@ -85,6 +85,11 @@
add license tmp/LICENSE license=sample_license
close """
+ licensed_pkg_2 = """
+ open pkg://test2/[email protected]
+ add license tmp/LICENSE2 license=sample_license
+ close """
+
signed_pkg = """
open pkg://test/[email protected]
add depend type=require [email protected]
@@ -107,7 +112,7 @@
close """
misc_files = ["tmp/foo", "tmp/libfoo.so.1", "tmp/libfoo_debug.so.1",
- "tmp/foo.1", "tmp/README", "tmp/LICENSE", "tmp/quux"]
+ "tmp/foo.1", "tmp/README", "tmp/LICENSE", "tmp/LICENSE2", "tmp/quux"]
def __seed_ta_dir(self, certs, dest_dir=None):
if isinstance(certs, basestring):
@@ -261,6 +266,8 @@
# Handle license package specially.
self.licensed10 = self.pkgsend_bulk(self.licensed_rurl,
self.licensed_pkg)[0]
+ self.licensed20 = self.pkgsend_bulk(self.licensed_rurl,
+ self.licensed_pkg_2)[0]
def test_00_list(self):
"""Verify that the list operation works as expected for
@@ -576,8 +583,12 @@
self.pkg("info -r \*", exit=1)
# Verify that --license works as expected with -g.
- self.pkg("info -g %s --license licensed" % self.licensed_rurl)
+ self.pkg("info -g %s --license [email protected]" %
+ self.licensed_rurl)
self.assertEqualDiff("tmp/LICENSE\n", self.output)
+ self.pkg("info -g %s --license licensed" %
+ self.licensed_rurl)
+ self.assertEqualDiff("tmp/LICENSE2\n", self.output)
# Cleanup.
self.image_destroy()
@@ -901,6 +912,39 @@
(self.incorp_arc, self.quux_arc))
self.pkg("list [email protected] [email protected]")
+ def test_06_appropriate_license_files(self):
+ """Verify that the correct license file is displayed."""
+
+ self.image_create()
+
+ self.pkg("info -g %s --license licensed" % self.licensed_rurl)
+ self.assertEqual("tmp/LICENSE2\n", self.output)
+ self.pkg("info -g %s --license [email protected]" %
+ self.licensed_rurl)
+ self.assertEqual("tmp/LICENSE\n", self.output)
+
+ self.pkg("install -g %s --licenses [email protected]" %
+ self.licensed_rurl)
+ self.assert_("tmp/LICENSE" in self.output, "Expected "
+ "tmp/LICENSE to be in the output of the install. Output "
+ "was:\n%s" % self.output)
+ self.pkg("info -g %s --license licensed" % self.licensed_rurl)
+ self.assertEqual("tmp/LICENSE2\n", self.output)
+ self.pkg("info -g %s --license [email protected]" %
+ self.licensed_rurl)
+ self.assertEqual("tmp/LICENSE2\n", self.output)
+
+ self.pkg("update -g %s --licenses [email protected]" %
+ self.licensed_rurl)
+ self.assert_("tmp/LICENSE2" in self.output, "Expected "
+ "tmp/LICENSE2 to be in the output of the install. Output "
+ "was:\n%s" % self.output)
+ self.pkg("info -g %s --license licensed" % self.licensed_rurl)
+ self.assertEqual("tmp/LICENSE2\n", self.output)
+ self.pkg("info -g %s --license [email protected]" %
+ self.licensed_rurl)
+ self.assertEqual("tmp/LICENSE\n", self.output)
+
if __name__ == "__main__":
unittest.main()