Esempio n. 1
0
File: app.py Progetto: strk/cartman
    def run_properties(self):
        """Lists the system's properties (Milestone, Component, etc.).

        usage: cm properties

        """
        properties = self.get_properties()

        def extract_options(prop):
            options = []
            options += prop["options"]
            if "optgroups" in prop:
                for optgroup in prop["optgroups"]:
                    options += optgroup["options"]
            return options

        output = []
        for title, prop in (("Milestones", "milestone"),
                ("Components", "component"),
                ("Status", "status"),
                ("Priorities", "priority")):
            if prop in properties:
                output.extend([
                    ui.title(title),
                    ", ".join(extract_options(properties[prop])),
                    ""])
        return output
Esempio n. 2
0
    def print_function_help(self, attrname):
        """Print the docstring for one function.

        :param attrname: Name of the function, with the run_ prefix.

        """
        func_name = attrname[4:]
        print(ui.title(func_name))
        print(getattr(self, attrname).__doc__)
Esempio n. 3
0
File: app.py Progetto: strk/cartman
    def print_function_help(self, attrname):
        """Print the docstring for one function.

        :param attrname: Name of the function, with the run_ prefix.

        """
        func_name = attrname[4:]
        print(ui.title(func_name))
        print(getattr(self, attrname).__doc__)
Esempio n. 4
0
    def run_properties(self):
        """Lists the system's properties (Milestone, Component, etc.).

        usage: cm properties

        """
        properties = self._get_properties()

        print(ui.title("Milestones"))
        print(", ".join(properties["milestone"]["options"]) + "\n")

        print(ui.title("Components"))
        print(", ".join(properties["component"]["options"]) + "\n")

        print(ui.title("Status"))
        print(", ".join(properties["status"]["options"]) + "\n")

        print(ui.title("Priority"))
        print(", ".join(properties["priority"]["options"]) + "\n")
Esempio n. 5
0
    def run_view(self, ticket_id):
        """Display a ticket summary.

        usage: cm view ticket_id

        """
        ticket_id = text.validate_id(ticket_id)

        query_string = "/ticket/{}?format=tab".format(ticket_id)

        t = next(self.get_tickets(query_string))
        title = t.format_title()

        print(ui.title(title))
        print("")

        print(t.description)
Esempio n. 6
0
    def run_properties(self):
        """Lists the system's properties (Milestone, Component, etc.).

        usage: cm properties

        """
        self.login()

        options = self.get_property_options()

        output = []
        for title, prop in (("Milestones", "milestone"), ("Components",
                                                          "component"),
                            ("Status", "status"), ("Priorities", "priority")):
            if prop in options:
                output.extend([ui.title(title), ", ".join(options[prop]), ""])
        return output
Esempio n. 7
0
    def run_properties(self):
        """Lists the system's properties (Milestone, Component, etc.).

        usage: cm properties

        """
        properties = self.get_properties()

        output = []
        for title, prop in (("Milestones", "milestone"),
                ("Components", "component"),
                ("Status", "status"),
                ("Priorities", "priority")):
            if prop in properties:
                output.extend([
                    ui.title(title),
                    ", ".join(properties[prop]["options"]),
                    ""])
        return output
Esempio n. 8
0
    def run_view(self, ticket_id):
        """Display a ticket summary.

        usage: cm view ticket_id

        """
        ticket_id = text.validate_id(ticket_id)

        query_string = "/ticket/{}?format=tab".format(ticket_id)

        self.login()

        t = next(self.get_tickets(query_string))
        title = t.format_title()

        return [
            ui.title(title),
            "",
            t.description,
        ]
Esempio n. 9
0
    def run_view(self, ticket_id):
        """Display a ticket summary.

        usage: cm view ticket_id

        """
        ticket_id = text.validate_id(ticket_id)

        query_string = "/ticket/{}?format=tab".format(ticket_id)

        self.login()

        t = next(self.get_tickets(query_string))
        title = t.format_title()

        return [
            ui.title(title),
            "",
            t.description,
        ]
Esempio n. 10
0
 def test_title_with_space(self):
     self.assertEquals(ui.title("a bcd"), "a bcd\n-----")
Esempio n. 11
0
 def test_title_one(self):
     self.assertEquals(ui.title("a"), "a\n-")
Esempio n. 12
0
 def test_title_empty(self):
     self.assertEquals(ui.title(""), "")