Beispiel #1
0
    def test_label_capitals(self):
        """ Check that various input labels (strings ending with a ':') are
            written with proper capitalization.

            Examples:
            Dough amount: - ok
            Salt: - ok
            Channel eggs through the Internet: - ok
            All Caps: - title case can't be used for labels

            Caveats:
            The test doesn't yet know which words are usually capitalized, so:
            Send to Kitchen: - will erroneously pass the test
        """
        fails = []
        ok_labels = L('Local _IP:', 'Songs with MBIDs:')

        for entry in self.pot:
            if not entry.msgid.endswith(':'):
                continue
            if ' ' not in entry.msgid.strip():
                continue
            if entry.msgid == human_title(entry.msgid):
                if entry.msgid not in ok_labels:
                    fails.append(entry)

        ok_labels.check_unused()
        self.conclude(fails, "title case used for a label")
Beispiel #2
0
    def test_plugin_desc(self):
        REASON_ABSENT = "plugin should have PLUGIN_DESC or PLUGIN_DESC_MARKUP"
        REASON_DOT = ("PLUGIN_DESC / PLUGIN_DESC_MARKUP "
                      "should be a full sentence and end with a '.'")

        skip_plugins = L('pickle_plugin')
        fails = []

        for pid, plugin in self.plugins.items():
            cls = plugin.cls
            if pid in skip_plugins:
                continue
            got = 0
            if hasattr(cls, 'PLUGIN_DESC'):
                got += 1
                desc = cls.PLUGIN_DESC
                if not desc.endswith('.'):
                    fails.append((plugin, desc, REASON_DOT))
                    continue
            if hasattr(cls, "PLUGIN_DESC_MARKUP"):
                got += 1
                desc = cls.PLUGIN_DESC_MARKUP
                if not desc.endswith('.'):
                    fails.append((plugin, desc, REASON_DOT))
                    continue
            if not got:
                fails.append((plugin, None, REASON_ABSENT))
        skip_plugins.check_unused()
        self.conclude(fails)
Beispiel #3
0
    def test_plugin_desc(self):
        REASON_ABSENT = "plugin should have PLUGIN_DESC"
        REASON_DOT = "PLUGIN_DESC should be a full sentence and end with a '.'"

        skip_plugins = L('pickle_test')
        fails = []

        for pid, plugin in self.plugins.items():
            if pid in skip_plugins:
                continue
            if not hasattr(plugin.cls, 'PLUGIN_DESC'):
                fails.append((plugin, None, REASON_ABSENT))
                continue
            desc = plugin.cls.PLUGIN_DESC
            if not desc.endswith('.'):
                fails.append((plugin, desc, REASON_DOT))

        skip_plugins.check_unused()
        self.conclude(fails)
Beispiel #4
0
    def test_plugin_name(self):
        REASON_ABSENT = "plugin should have PLUGIN_NAME"
        REASON_CASE = "PLUGIN_NAME should be in Title Case"

        ok_names = L('Last.fm Cover Source', 'Last.fm Sync', 'Send to iFP',
                     'This is a test')
        fails = []

        for pid, plugin in self.plugins.items():
            if not hasattr(plugin.cls, 'PLUGIN_NAME'):
                fails.append((plugin, None, REASON_ABSENT))
                continue
            name = plugin.cls.PLUGIN_NAME
            if name != human_title(name):
                if name not in ok_names:
                    fails.append((plugin, name, REASON_CASE))

        ok_names.check_unused()
        self.conclude(fails)