def create_ticket(self, summary=None, info=None):
        """Create a new (random) ticket in the test environment.  Returns
        the new ticket number.

        :param summary:
            may optionally be set to the desired summary
        :param info:
            may optionally be set to a dictionary of field value pairs for
            populating the ticket.  ``info['summary']`` overrides summary.

        `summary` and `description` default to randomly-generated values.
        """
        info = info or {}
        self.go_to_front()
        tc.follow(r"\bNew Ticket\b")
        tc.notfind(internal_error)
        if summary is None:
            summary = random_sentence(5)
        tc.formvalue('propertyform', 'field_summary', summary)
        tc.formvalue('propertyform', 'field_description', random_page())
        if 'owner' in info:
            tc.formvalue('propertyform', 'action', 'assign')
            tc.formvalue('propertyform',
                         'action_create_and_assign_reassign_owner',
                         info.pop('owner'))
        for field, value in info.items():
            tc.formvalue('propertyform', 'field_%s' % field, value)
        tc.submit('submit')
        tc.notfind(internal_error)
        # we should be looking at the newly created ticket
        tc.url(self.url + '/ticket/%s' % (self.ticketcount + 1))
        # Increment self.ticketcount /after/ we've verified that the ticket
        # was created so a failure does not trigger spurious later
        # failures.
        self.ticketcount += 1

        return self.ticketcount
dataset/ETHPy150Open edgewall/trac/trac/tests/functional/tester.py/FunctionalTester.create_ticket/original