Пример #1
0
    def test_description_from_spec(self):
        """
        Test description_from_spec with summary and description present in
        spec file
        """
        content = "# this is a specfile\n"          \
                "License: GPL v2\n"                 \
                "Summary: This is a test package\n" \
                "\n"                                \
                "%description\n"                    \
                "Here is the description section\n" \
                "Look it continues until the\n"     \
                "line that begins with '%'\n"       \
                "\n"                                \
                "%donewithdesc\n"
        m_open = mock_open(read_data=content)
        with patch(self.open_name, m_open, create=True):
            specdescription.description_from_spec("filename", {}, [])

        self.assertEqual(
            specdescription.default_description,
            "Here is the description section\n"
            "Look it continues until the\n"
            "line that begins with '%'\n\n")
        self.assertEqual(specdescription.default_summary,
                         "This is a test package\n")
        self.assertEqual(specdescription.default_description_score, 4)
        self.assertEqual(specdescription.default_summary_score, 4)
        self.assertEqual(specdescription.license.licenses, ["GPL-2"])
Пример #2
0
    def test_description_from_spec_no_info(self):
        """
        Test description_from_spec with no license, summary or description in
        spec file
        """
        content = "# this is a specfile without much in it\n"
        m_open = mock_open(read_data=content)
        with patch(self.open_name, m_open, create=True):
            specdescription.description_from_spec("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, [])