コード例 #1
0
    def test_getPluginNameAndModuleFromStream_with_invalid_descriptions(self):
        plugin_desc_content = StringIO("""\
[Core]
Name = Bla{0}Bli
Module = SimplePlugin
""".format(PLUGIN_NAME_FORBIDEN_STRING))
        analyzer = PluginFileAnalyzerWithInfoFile("mouf", ("yapsy-plugin"))
        res = analyzer._extractCorePluginInfo("bla", plugin_desc_content)
        self.assertEqual((None, None), res)
        plugin_desc_content = StringIO("""\
[Core]
Name = Simple Plugin
""")
        analyzer = PluginFileAnalyzerWithInfoFile("mouf", ("yapsy-plugin"))
        res = analyzer._extractCorePluginInfo("bla", plugin_desc_content)
        self.assertEqual((None, None), res)
        plugin_desc_content = StringIO("""\
[Core]
Module = Simple Plugin
""")
        res = analyzer._extractCorePluginInfo("bla", plugin_desc_content)
        self.assertEqual((None, None), res)
        plugin_desc_content = StringIO("""\
[Mouf]
Bla = Simple Plugin
""")
        res = analyzer._extractCorePluginInfo("bla", plugin_desc_content)
        self.assertEqual((None, None), res)
コード例 #2
0
	def test_getPluginNameAndModuleFromStream_with_invalid_descriptions(self):
		plugin_desc_content = StringIO("""\
[Core]
Name = Bla{0}Bli
Module = SimplePlugin
""".format(PLUGIN_NAME_FORBIDEN_STRING))
		analyzer = PluginFileAnalyzerWithInfoFile("mouf",
												  ("yapsy-plugin"))
		res = analyzer._extractCorePluginInfo("bla",plugin_desc_content)
		self.assertEqual((None, None), res)
		plugin_desc_content = StringIO("""\
[Core]
Name = Simple Plugin
""")
		analyzer = PluginFileAnalyzerWithInfoFile("mouf",
												  ("yapsy-plugin"))
		res = analyzer._extractCorePluginInfo("bla",plugin_desc_content)
		self.assertEqual((None, None), res)
		plugin_desc_content = StringIO("""\
[Core]
Module = Simple Plugin
""")
		res = analyzer._extractCorePluginInfo("bla",plugin_desc_content)
		self.assertEqual((None, None), res)
		plugin_desc_content = StringIO("""\
[Mouf]
Bla = Simple Plugin
""")
		res = analyzer._extractCorePluginInfo("bla",plugin_desc_content)
		self.assertEqual((None, None), res)
コード例 #3
0
	def test__extractCorePluginInfo_with_builtin_str_filename(self):
		plugin_desc_content = builtin_str("simpleplugin.yapsy-plugin")
		analyzer = PluginFileAnalyzerWithInfoFile("mouf", ("yapsy-plugin"))
		infos, parser = analyzer._extractCorePluginInfo(self.plugin_directory,
														plugin_desc_content)
		self.assertEqual("Simple Plugin", infos["name"])
		self.assertEqual(os.path.join(self.plugin_directory, "SimplePlugin"), infos["path"])
コード例 #4
0
	def test__extractCorePluginInfo_with_builtin_str_filename(self):
		plugin_desc_content = builtin_str("simpleplugin.yapsy-plugin")
		analyzer = PluginFileAnalyzerWithInfoFile("mouf", ("yapsy-plugin"))
		infos, parser = analyzer._extractCorePluginInfo(self.plugin_directory,
														plugin_desc_content)
		self.assertEqual("Simple Plugin", infos["name"])
		self.assertEqual(os.path.join(self.plugin_directory, "SimplePlugin"), infos["path"])
コード例 #5
0
	def test__extractCorePluginInfo_with_unicode_filename(self):
		"""Note: this test is redundant with its 'builtin_str' counterpart on Python3
		but not on Python2"""
		# Note: compat.py redefines str as unicode for Python2
		plugin_desc_content = str("simpleplugin.yapsy-plugin")
		analyzer = PluginFileAnalyzerWithInfoFile("mouf", ("yapsy-plugin"))
		infos, parser = analyzer._extractCorePluginInfo(self.plugin_directory,
														plugin_desc_content)
		self.assertEqual("Simple Plugin", infos["name"])
		self.assertEqual(os.path.join(self.plugin_directory, "SimplePlugin"), infos["path"])
コード例 #6
0
	def test__extractCorePluginInfo_with_unicode_filename(self):
		"""Note: this test is redundant with its 'builtin_str' counterpart on Python3
		but not on Python2"""
		# Note: compat.py redefines str as unicode for Python2
		plugin_desc_content = str("simpleplugin.yapsy-plugin")
		analyzer = PluginFileAnalyzerWithInfoFile("mouf", ("yapsy-plugin"))
		infos, parser = analyzer._extractCorePluginInfo(self.plugin_directory,
														plugin_desc_content)
		self.assertEqual("Simple Plugin", infos["name"])
		self.assertEqual(os.path.join(self.plugin_directory, "SimplePlugin"), infos["path"])
コード例 #7
0
    def test__extractCorePluginInfo_with_minimal_description(self):
        plugin_desc_content = StringIO("""\
[Core]
Name = Simple Plugin
Module = SimplePlugin
""")
        analyzer = PluginFileAnalyzerWithInfoFile("mouf", ("yapsy-plugin"))
        infos, parser = analyzer._extractCorePluginInfo(
            "bla", plugin_desc_content)
        self.assertEqual("Simple Plugin", infos["name"])
        self.assertEqual(os.path.join("bla", "SimplePlugin"), infos["path"])
        self.assertTrue(isinstance(parser, ConfigParser))
コード例 #8
0
	def test__extractCorePluginInfo_with_minimal_description(self):
		plugin_desc_content = StringIO("""\
[Core]
Name = Simple Plugin
Module = SimplePlugin
""")
		analyzer = PluginFileAnalyzerWithInfoFile("mouf",
												  ("yapsy-plugin"))
		infos, parser = analyzer._extractCorePluginInfo("bla",plugin_desc_content)
		self.assertEqual("Simple Plugin", infos["name"])
		self.assertEqual(os.path.join("bla","SimplePlugin"), infos["path"])
		self.assertTrue(isinstance(parser,ConfigParser))