Example #1
0
    def test_description_from_pkginfo(self):
        """
        Test description_from_pkginfo with information in pkg-info file
        """
        content = "# this is a package info file\n"  \
                "License: GPL v2\n"                  \
                "abstract: This is a test package\n" \
                "\n"                                 \
                "Description:\n"                     \
                "Here is the description section\n"  \
                "Look it continues until the\n"      \
                "line that contains a colon.\n"      \
                "\n"                                 \
                "donewithdesc:\n"
        m_open = mock_open(read_data=content)
        with patch(self.open_name, m_open, create=True):
            specdescription.description_from_pkginfo("filename", {}, [])

        self.assertEqual(
            specdescription.default_description,
            "Here is the description section\n"
            "Look it continues until the\n"
            "line that contains a colon.\n\n")
        self.assertEqual(specdescription.default_summary,
                         "This is a test package")
        self.assertEqual(specdescription.default_description_score, 4)
        self.assertEqual(specdescription.default_summary_score, 4)
        self.assertEqual(specdescription.license.licenses, ["GPL-2"])
Example #2
0
    def test_description_from_pkginfo_no_info(self):
        """
        Test description_from_pkginfo with no information in the pkginfo file
        """
        content = "# this is a pkginfo file without much in it\n"
        m_open = mock_open(read_data=content)
        with patch(self.open_name, m_open, create=True):
            specdescription.description_from_pkginfo("filename", {}, [])

        self.assertEqual(specdescription.default_description,
                         "No detailed description available")
        self.assertEqual(specdescription.default_summary,
                         "No detailed summary available")
        self.assertEqual(specdescription.default_description_score, 0)
        self.assertEqual(specdescription.default_summary_score, 0)
        self.assertEqual(specdescription.license.licenses, [])