示例#1
0
    def test_changelog_single_changes_date(self):
        changes = [u'Исправление ошибок.', u'Добавлена новая возможность.']
        version_1 = VersionInfo(Version(1, 0),
                                date_str=u'1 мая 2016',
                                changes=changes)
        changelog = [version_1]
        appinfo = AppInfo(self._appname, self._author, changelog)
        generator = SiteChangelogGenerator(appinfo)
        changelog = generator.make()

        right_result = u'''!!!! 1.0 (1 мая 2016)

* Исправление ошибок.
* Добавлена новая возможность.'''
        self.assertEqual(changelog, right_result)
示例#2
0
    def test_filter_empty_05(self):
        from updatenotifier.updatecontroller import UpdateController

        plugin = self.loader['UpdateNotifier']
        controller = UpdateController(self.application, plugin)

        latestVersion = Version(1, 0)
        latestVersionInfo = VersionInfo(latestVersion)

        currentVersionsDict = {'test_02': '1.0'}
        latestVersionsDict = {
            'test_01': AppInfo('test', None, versionsList=[latestVersionInfo]),
        }

        result = controller.filterUpdatedApps(currentVersionsDict,
                                              latestVersionsDict)

        self.assertEqual(result, {})
示例#3
0
    def _getVersionInfo(self, version_tag):
        assert version_tag is not None
        version = self._getVersion(version_tag)
        if version is None:
            return None

        date = version_tag.get(u'date', u'')
        hidden = False
        try:
            hidden = bool(version_tag.get(u'hidden'))
        except ValueError:
            pass
        changes = self._getChanges(version_tag)
        downloads = self._getDownloads(version_tag)

        return VersionInfo(version,
                           date_str=date,
                           downloads=downloads,
                           changes=changes,
                           hidden=hidden)
    def test_filter_empty_04(self):
        from updatenotifier.updatecontroller import UpdateController

        pluginPath = self.loader[u'UpdateNotifier'].pluginPath
        controller = UpdateController(Application, pluginPath)

        latestVersion = Version(1, 0)
        latestVersionInfo = VersionInfo(latestVersion)

        currentVersionsDict = {}
        latestVersionsDict = {
            u'test_01': AppInfo(u'test',
                                None,
                                versionsList=[latestVersionInfo]),
        }

        result = controller.filterUpdatedApps(currentVersionsDict,
                                              latestVersionsDict)

        self.assertEqual(result, {})
示例#5
0
    def test_changelog_02(self):
        changes_1 = [u'Изменение 1']
        version_1 = VersionInfo(Version(1, 2, 3, 100), changes=changes_1)

        maintainer = u'Ivan Petrov'
        maintainer_email = u'*****@*****.**'
        changelog = [version_1]
        date_str = u'13.06.2016'

        appinfo = AppInfo(self._appname, None, changelog)
        generator = DebChangelogGenerator(appinfo, maintainer,
                                          maintainer_email)

        result = generator.make(self._distrib, date_str)

        result_right = u'''outwiker (1.2.3+100~distribname) distribname; urgency=medium

  * Изменение 1

 -- Ivan Petrov <*****@*****.**>  13.06.2016'''

        self.assertEqual(result, result_right)
    def test_filter_09(self):
        from updatenotifier.updatecontroller import UpdateController

        pluginPath = self.loader[u'UpdateNotifier'].pluginPath
        controller = UpdateController(Application, pluginPath)

        latestVersion = Version(1, 1)
        latestVersionInfo = VersionInfo(latestVersion)

        currentVersionsDict = {u'test_01': u'1.0',
                               u'test_02': u'2.0',
                               }

        latestVersionsDict = {
            u'test_01': AppInfo(u'test',
                                None,
                                versionsList=[latestVersionInfo]),
        }

        result = controller.filterUpdatedApps(currentVersionsDict,
                                              latestVersionsDict)

        self.assertEqual(len(result), 1)
        self.assertEqual(result[u'test_01'].appname, u'test')