Ejemplo n.º 1
0
    def testMan(self):
        out, err = self.run_0install(['man', '--help'])
        assert out.lower().startswith("usage:")

        # Wrong number of args: pass-through
        self.check_man(['git', 'config'], ('man', 'git', 'config'))
        self.check_man([], ('man', ))

        local_feed = os.path.join(mydir, 'Local.xml')
        launcher_script = os.path.join(apps.find_bin_dir(), 'my-test-alias')
        with open(launcher_script, 'w') as stream:
            alias.write_script(stream, model.canonical_iface_uri(local_feed),
                               None)
        self.check_man(['my-test-alias'], 'tests/test-echo.1')

        self.check_man(['__i_dont_exist'], '__i_dont_exist')
        self.check_man(['ls'], 'ls')

        # No man-page
        binary_feed = os.path.join(mydir, 'Command.xml')
        launcher_script = os.path.join(apps.find_bin_dir(), 'my-binary-alias')
        with open(launcher_script, 'w') as stream:
            alias.write_script(stream, model.canonical_iface_uri(binary_feed),
                               None)

        out, err = self.run_0install(['man', 'my-binary-alias'])
        assert not err, err
        assert "No matching manpage was found for 'my-binary-alias'" in out, out

        with open(os.path.join(self.config_home, 'bad-unicode'),
                  'wb') as stream:
            stream.write(bytes([198, 65]))
        self.check_man(['bad-unicode'], 'bad-unicode')
Ejemplo n.º 2
0
	def testMan(self):
		out, err = self.run_0install(['man', '--help'])
		assert out.lower().startswith("usage:")

		# Wrong number of args: pass-through
		self.check_man(['git', 'config'], ('man', 'git', 'config'))
		self.check_man([], ('man',))

		alias_path = os.path.join(mydir, '..', '0alias')
		local_feed = os.path.join(mydir, 'Local.xml')
		launcher_script = os.path.join(apps.find_bin_dir(), 'my-test-alias')
		with open(launcher_script, 'w') as stream:
			alias.write_script(stream, model.canonical_iface_uri(local_feed), None)
		self.check_man(['my-test-alias'], 'tests/test-echo.1')

		self.check_man(['__i_dont_exist'], '__i_dont_exist')
		self.check_man(['ls'], 'ls')

		# No man-page
		binary_feed = os.path.join(mydir, 'Command.xml')
		launcher_script = os.path.join(apps.find_bin_dir(), 'my-binary-alias')
		with open(launcher_script, 'w') as stream:
			alias.write_script(stream, model.canonical_iface_uri(binary_feed), None)

		out, err = self.run_0install(['man', 'my-binary-alias'])
		assert not err, err
		assert "No matching manpage was found for 'my-binary-alias'" in out, out

		with open(os.path.join(self.config_home, 'bad-unicode'), 'wb') as stream:
			stream.write(bytes([198, 65]))
		self.check_man(['bad-unicode'], 'bad-unicode')
Ejemplo n.º 3
0
	def testWrite(self):
		buf = StringIO()
		alias.write_script(buf, 'http://example.com/foo.xml', None)
		self.assertEquals(expected_script, buf.getvalue())

		buf = StringIO()
		alias.write_script(buf, 'http://example.com/foo.xml', 'a\'\'\\test')
		self.assertEquals(expected_script_main, buf.getvalue())
Ejemplo n.º 4
0
    def testWrite(self):
        buf = StringIO()
        alias.write_script(buf, 'http://example.com/foo.xml', None)
        self.assertEquals(expected_script, buf.getvalue())

        buf = StringIO()
        alias.write_script(buf, 'http://example.com/foo.xml', 'a\'\'\\test')
        self.assertEquals(expected_script_main, buf.getvalue())
Ejemplo n.º 5
0
	def testUpdateAlias(self):
		local_feed = os.path.join(mydir, 'Local.xml')
		launcher_script = os.path.join(apps.find_bin_dir(), 'my-test-alias')
		with open(launcher_script, 'w') as stream:
			alias.write_script(stream, local_feed, None)

		out, err = self.run_0install(['update', 'my-test-alias'])
		self.assertEqual("Bad interface name 'my-test-alias'.\n(hint: try 'alias:my-test-alias' instead)\n", err)
		self.assertEqual("", out)
Ejemplo n.º 6
0
	def testUpdateAlias(self):
		local_feed = os.path.join(mydir, 'Local.xml')
		launcher_script = os.path.join(self.config_home, 'my-test-alias')
		with open(launcher_script, 'w') as stream:
			alias.write_script(stream, local_feed, None)

		out, err = self.run_ocaml(['update', 'my-test-alias'])
		assert err.startswith("Bad interface name 'my-test-alias'.\n(hint: try 'alias:my-test-alias' instead)\n"), err
		self.assertEqual("", out)
Ejemplo n.º 7
0
    def testUpdateAlias(self):
        local_feed = os.path.join(mydir, 'Local.xml')
        launcher_script = os.path.join(apps.find_bin_dir(), 'my-test-alias')
        with open(launcher_script, 'w') as stream:
            alias.write_script(stream, local_feed, None)

        out, err = self.run_0install(['update', 'my-test-alias'])
        self.assertEqual(
            "Bad interface name 'my-test-alias'.\n(hint: try 'alias:my-test-alias' instead)\n",
            err)
        self.assertEqual("", out)
Ejemplo n.º 8
0
    def testUpdateAlias(self):
        local_feed = os.path.join(mydir, 'Local.xml')
        launcher_script = os.path.join(self.config_home, 'my-test-alias')
        with open(launcher_script, 'w') as stream:
            alias.write_script(stream, local_feed, None)

        out, err = self.run_ocaml(['update', 'my-test-alias'])
        assert err.startswith(
            "Bad interface name 'my-test-alias'.\n(hint: try 'alias:my-test-alias' instead)\n"
        ), err
        self.assertEqual("", out)