Beispiel #1
0
    def test_RPMHeaderPackageInfo_getPathList(self):
        """
        Ensure getPathList is working correctly with indexes.
        """
        header = {
            rpm.RPMTAG_OLDFILENAMES: [],
            rpm.RPMTAG_BASENAMES: "foo",
            rpm.RPMTAG_DIRINDEXES: 0,
            rpm.RPMTAG_DIRNAMES: "/dir/",
            rpm.RPMTAG_FILEMODES: 0644
        }

        package = self.mocker.mock()
        loader = self.mocker.mock()
        loader.getHeader(package)
        self.mocker.result(header)

        # Just assert it's called at all.
        mock_func = self.mocker.replace(get_header_filenames)
        mock_func(header)
        self.mocker.passthrough()

        self.mocker.replay()

        info = RPMHeaderPackageInfo(package, loader)
        self.assertEquals(info.getPathList(), ["/dir/foo"])
Beispiel #2
0
 def test_getDescription_without_header(self):
     package = self.mocker.mock()
     loader = self.mocker.mock()
     loader.getHeader(package)
     self.mocker.replay()
     info = RPMHeaderPackageInfo(package, loader)
     self.assertEquals(info.getDescription(), u"")
 def test_getDescription_without_header(self):
     package = self.mocker.mock()
     loader = self.mocker.mock()
     loader.getHeader(package)
     self.mocker.replay()
     info = RPMHeaderPackageInfo(package, loader)
     self.assertEquals(info.getDescription(), u"")
Beispiel #4
0
 def test_getDescription_decodes_string(self):
     package = self.mocker.mock()
     loader = self.mocker.mock()
     loader.getHeader(package)
     self.mocker.result({rpm.RPMTAG_DESCRIPTION: "áéíóú"})
     self.mocker.replay()
     info = RPMHeaderPackageInfo(package, loader)
     self.assertEquals(info.getDescription(), u"áéíóú")
Beispiel #5
0
 def test_getSummary_decodes_string(self):
     package = self.mocker.mock()
     loader = self.mocker.mock()
     loader.getHeader(package)
     self.mocker.result({rpm.RPMTAG_SUMMARY: "áéíóú"})
     self.mocker.replay()
     info = RPMHeaderPackageInfo(package, loader)
     self.assertEquals(info.getSummary(), u"áéíóú")
Beispiel #6
0
 def test_getSummary_without_tag(self):
     package = self.mocker.mock()
     loader = self.mocker.mock()
     loader.getHeader(package)
     self.mocker.result({})
     self.mocker.replay()
     info = RPMHeaderPackageInfo(package, loader)
     self.assertEquals(info.getSummary(), u"")
 def test_getDescription_decodes_string(self):
     package = self.mocker.mock()
     loader = self.mocker.mock()
     loader.getHeader(package)
     self.mocker.result({rpm.RPMTAG_DESCRIPTION: "áéíóú"})
     self.mocker.replay()
     info = RPMHeaderPackageInfo(package, loader)
     self.assertEquals(info.getDescription(), u"áéíóú")
 def test_getSummary_decodes_string(self):
     package = self.mocker.mock()
     loader = self.mocker.mock()
     loader.getHeader(package)
     self.mocker.result({rpm.RPMTAG_SUMMARY: "áéíóú"})
     self.mocker.replay()
     info = RPMHeaderPackageInfo(package, loader)
     self.assertEquals(info.getSummary(), u"áéíóú")
 def test_getSummary_without_tag(self):
     package = self.mocker.mock()
     loader = self.mocker.mock()
     loader.getHeader(package)
     self.mocker.result({})
     self.mocker.replay()
     info = RPMHeaderPackageInfo(package, loader)
     self.assertEquals(info.getSummary(), u"")
    def test_RPMHeaderPackageInfo_getPathList(self):
        """
        Ensure getPathList is working correctly with indexes.
        """
        header = {rpm.RPMTAG_OLDFILENAMES: [],
                  rpm.RPMTAG_BASENAMES: "foo",
                  rpm.RPMTAG_DIRINDEXES: 0,
                  rpm.RPMTAG_DIRNAMES: "/dir/",
                  rpm.RPMTAG_FILEMODES: 0644}

        package = self.mocker.mock()
        loader = self.mocker.mock()
        loader.getHeader(package)
        self.mocker.result(header)

        # Just assert it's called at all.
        mock_func = self.mocker.replace(get_header_filenames)
        mock_func(header)
        self.mocker.passthrough()

        self.mocker.replay()

        info = RPMHeaderPackageInfo(package, loader)
        self.assertEquals(info.getPathList(), ["/dir/foo"])