Ejemplo n.º 1
0
    def test_softwareByUverName(self):
        """Should return a software instance by uver name."""
        softwares = self.__getSoftwares()
        query = Query(softwares)

        for index, software in enumerate(softwares):
            self.assertEqual(query.softwareByUverName(software.uverName()),
                             softwares[index])
Ejemplo n.º 2
0
    def test_addonUverNames(self):
        """Should return a list of expected uver addon names."""
        softwares = self.__getSoftwares()
        query = Query(softwares)
        addonNames = query.addonUverNames()

        self.assertEqual(len(addonNames), 1)
        self.assertListEqual(['UVER_A_VERSION'], addonNames)
Ejemplo n.º 3
0
    def test_softwareNames(self):
        """Should return a list of expected software names."""
        softwares = self.__getSoftwares()
        query = Query(softwares)

        softwareNames = query.softwareNames()

        self.assertEqual(len(softwareNames), len(softwares))
        self.assertListEqual(
            list(filter(lambda x: x.name() not in softwareNames, softwares)),
            [])
Ejemplo n.º 4
0
    def test_softwaresByAddonUverName(self):
        """Should return a list of softwares based on the addon uver name."""
        softwares = self.__getSoftwares()
        query = Query(softwares)

        softwareList = query.softwaresByAddonUverName('UVER_A_VERSION')

        self.assertEqual(len(softwareList), 2)

        for software in softwareList:
            self.assertIn(software.name(), ['B', 'C'])
Ejemplo n.º 5
0
    def test_softwareByUverNameError(self):
        """Should raise an exception when software was not found (uver)."""
        softwares = self.__getSoftwares()
        query = Query(softwares)

        success = False
        try:
            query.softwareByUverName('UVER_E_VERSION')
        except SoftwareNotFoundError:
            success = True

        self.assertTrue(success)
Ejemplo n.º 6
0
    def test_softwaresByAddonUverNameError(self):
        """Should raise an exception when addon name was not found (uver)."""
        softwares = self.__getSoftwares()
        query = Query(softwares)

        success = False
        try:
            query.softwaresByAddonUverName('B')
        except AddonNotFoundError:
            success = True

        self.assertTrue(success)
Ejemplo n.º 7
0
    def test_constructor(self):
        """Should test the constructor."""
        softwares = self.__getSoftwares()
        query = Query(softwares)

        self.assertEqual(len(softwares), len(query.softwares()))