Пример #1
0
    def create_milestone(self, name=None, due=None):
        """Creates the specified milestone, with a random name if none is
        provided.  Returns the name of the milestone.
        """
        if name is None:
            name = random_unique_camel()
        milestone_url = self.url + "/admin/ticket/milestones"
        tc.go(milestone_url)
        tc.url(milestone_url)
        tc.formvalue('addmilestone', 'name', name)
        if due:
            # TODO: How should we deal with differences in date formats?
            tc.formvalue('addmilestone', 'duedate', due)
        tc.submit()
        tc.notfind(internal_error)
        tc.notfind('Milestone .* already exists')
        tc.url(milestone_url)
        tc.find(name)

        # Make sure it's on the roadmap.
        tc.follow(r"\bRoadmap\b")
        tc.url(self.url + "/roadmap")
        tc.find('Milestone:.*%s' % name)
        tc.follow(r"\b%s\b" % name)
        tc.url('%s/milestone/%s' % (self.url, unicode_quote(name)))
        if not due:
            tc.find('No date set')

        return name
Пример #2
0
 def create_component(self, name=None, owner=None, description=None):
     """Creates the specified component, with a random camel-cased name if
     none is provided.  Returns the name."""
     if name is None:
         name = random_unique_camel()
     component_url = self.url + "/admin/ticket/components"
     tc.go(component_url)
     tc.url(component_url)
     tc.formvalue('addcomponent', 'name', name)
     if owner is not None:
         tc.formvalue('addcomponent', 'owner', owner)
     tc.submit()
     # Verify the component appears in the component list
     tc.url(component_url)
     tc.find(name)
     tc.notfind(internal_error)
     if description is not None:
         tc.follow(r"\b%s\b" % name)
         tc.formvalue('modcomp', 'description', description)
         tc.submit('save')
         tc.url(component_url)
         tc.find("Your changes have been saved.")
         tc.notfind(internal_error)
     # TODO: verify the component shows up in the newticket page
     return name
Пример #3
0
 def create_component(self, name=None, owner=None, description=None):
     """Creates the specified component, with a random camel-cased name if
     none is provided.  Returns the name."""
     if name is None:
         name = random_unique_camel()
     component_url = self.url + "/admin/ticket/components"
     tc.go(component_url)
     tc.url(component_url)
     tc.formvalue('addcomponent', 'name', name)
     if owner is not None:
         tc.formvalue('addcomponent', 'owner', owner)
     tc.submit()
     # Verify the component appears in the component list
     tc.url(component_url)
     tc.find(name)
     tc.notfind(internal_error)
     if description is not None:
         tc.follow(r"\b%s\b" % name)
         tc.formvalue('edit', 'description', description)
         tc.submit('save')
         tc.url(component_url)
         tc.find("Your changes have been saved.")
         tc.notfind(internal_error)
     # TODO: verify the component shows up in the newticket page
     return name
Пример #4
0
    def create_milestone(self, name=None, due=None):
        """Creates the specified milestone, with a random name if none is
        provided.  Returns the name of the milestone.
        """
        if name == None:
            name = random_unique_camel()
        milestone_url = self.url + "/admin/ticket/milestones"
        tc.go(milestone_url)
        tc.url(milestone_url)
        tc.formvalue('addmilestone', 'name', name)
        if due:
            # TODO: How should we deal with differences in date formats?
            tc.formvalue('addmilestone', 'duedate', due)
        tc.submit()
        tc.notfind(internal_error)
        tc.notfind('Milestone .* already exists')
        tc.url(milestone_url)
        tc.find(name)

        # Make sure it's on the roadmap.
        tc.follow('Roadmap')
        tc.url(self.url + "/roadmap")
        tc.find('Milestone:.*%s' % name)
        tc.follow(name)
        tc.url('%s/milestone/%s' % (self.url, unicode_quote(name)))
        if not due:
            tc.find('No date set')

        return name
Пример #5
0
 def go_to_view_tickets(self, href='report'):
     """Surf to the View Tickets page. By default this will be the Reports
     page, but 'query' can be specified for the `href` argument to support
     non-default configurations."""
     self.go_to_front()
     tc.follow(r"\bView Tickets\b")
     tc.url(self.url + '/' + href.lstrip('/'))
Пример #6
0
    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.
        """
        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 info:
            for field, value in info.items():
                tc.formvalue('propertyform', 'field_%s' % field, value)
        tc.submit('submit')
        # we should be looking at the newly created ticket
        tc.url(self.url + '/ticket/%s' % (self.ticketcount + 1))
        tc.notfind(internal_error)
        # 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
Пример #7
0
 def go_to_view_tickets(self, href='report'):
     """Surf to the View Tickets page. By default this will be the Reports
     page, but 'query' can be specified for the `href` argument to support
     non-default configurations."""
     self.go_to_front()
     tc.follow('View Tickets')
     tc.url(self.url + '/' + href.lstrip('/'))
Пример #8
0
 def go_to_preferences(self, panel_label=None):
     """Surf to the preferences page. Continue surfing to a specific
     preferences panel if `panel_label` is specified."""
     self.go_to_front()
     tc.follow(r"\bPreferences\b")
     tc.url(self.url + '/prefs')
     if panel_label is not None:
         tc.follow(r"\b%s\b" % panel_label)
Пример #9
0
 def go_to_admin(self, panel_label=None):
     """Surf to the webadmin page. Continue surfing to a specific
     admin page if `panel_label` is specified."""
     self.go_to_front()
     tc.follow(r"\bAdmin\b")
     tc.url(self.url + '/admin')
     if panel_label is not None:
         tc.follow(r"\b%s\b" % panel_label)
Пример #10
0
 def go_to_admin(self, panel_label=None):
     """Surf to the webadmin page. Continue surfing to a specific
     admin page if `panel_label` is specified."""
     self.go_to_front()
     tc.follow(r"\bAdmin\b")
     tc.url(self.url + '/admin')
     if panel_label is not None:
         tc.follow(r"\b%s\b" % panel_label)
Пример #11
0
 def go_to_preferences(self, panel_label=None):
     """Surf to the preferences page. Continue surfing to a specific
     preferences panel if `panel_label` is specified."""
     self.go_to_front()
     tc.follow(r"\bPreferences\b")
     tc.url(self.url + '/prefs')
     if panel_label is not None:
         tc.follow(r"\b%s\b" % panel_label)
Пример #12
0
 def login(self, username):
     """Login as the given user"""
     tc.add_auth("", self.url, username, username)
     self.go_to_front()
     tc.find("Login")
     tc.follow("Login")
     # We've provided authentication info earlier, so this should
     # redirect back to the base url.
     tc.find("logged in as %s" % username)
     tc.find("Logout")
     tc.url(self.url)
     tc.notfind(internal_error)
Пример #13
0
 def login(self, username):
     """Login as the given user"""
     tc.add_auth("", self.url, username, username)
     self.go_to_front()
     tc.find("Login")
     tc.follow("Login")
     # We've provided authentication info earlier, so this should
     # redirect back to the base url.
     tc.find("logged in as %s" % username)
     tc.find("Logout")
     tc.url(self.url)
     tc.notfind(internal_error)
Пример #14
0
 def login(self, username):
     """Login as the given user"""
     username = to_utf8(username)
     tc.add_auth("", self.url, username, username)
     self.go_to_front()
     tc.find("Login")
     tc.follow(r"\bLogin\b")
     # We've provided authentication info earlier, so this should
     # redirect back to the base url.
     tc.find('logged in as[ \t\n]+<span class="trac-author-user">%s</span>'
             % username)
     tc.find("Logout")
     tc.url(self.url)
     tc.notfind(internal_error)
Пример #15
0
 def create_report(self, title, query, description):
     """Create a new report with the given title, query, and description"""
     self.go_to_front()
     tc.follow(r"\bView Tickets\b")
     tc.submit(formname='create_report')
     tc.find('New Report')
     tc.notfind(internal_error)
     tc.formvalue('edit_report', 'title', title)
     tc.formvalue('edit_report', 'description', description)
     tc.formvalue('edit_report', 'query', query)
     tc.submit()
     reportnum = b.get_url().split('/')[-1]
     # TODO: verify the url is correct
     # TODO: verify the report number is correct
     # TODO: verify the report does not cause an internal error
     # TODO: verify the title appears on the report list
     return reportnum
Пример #16
0
 def create_report(self, title, query, description):
     """Create a new report with the given title, query, and description"""
     self.go_to_front()
     tc.follow('View Tickets')
     tc.formvalue('create_report', 'action', 'new') # select the right form
     tc.submit()
     tc.find('New Report')
     tc.notfind(internal_error)
     tc.formvalue('edit_report', 'title', title)
     tc.formvalue('edit_report', 'description', description)
     tc.formvalue('edit_report', 'query', query)
     tc.submit()
     reportnum = b.get_url().split('/')[-1]
     # TODO: verify the url is correct
     # TODO: verify the report number is correct
     # TODO: verify the report does not cause an internal error
     # TODO: verify the title appears on the report list
     return reportnum
Пример #17
0
    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', 'create_and_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('%s/ticket/%s#ticket' % (self.url, self.ticketcount + 1),
               regexp=False)
        # 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
Пример #18
0
    def create_ticket(self, summary=None, info=None):
        """Create a new (random) ticket in the test environment.  Returns
        the new ticket number.

        :summary:
            may optionally be set to the desired summary
        :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.
        """
        self.go_to_front()
        tc.follow('New Ticket')
        tc.notfind(internal_error)
        if summary == None:
            summary = random_sentence(4)
        tc.formvalue('propertyform', 'field_summary', summary)
        tc.formvalue('propertyform', 'field_description', random_page())
        if info:
            for field, value in info.items():
                tc.formvalue('propertyform', 'field_%s' % field, value)
        tc.submit('submit')
        # 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

        # verify the ticket creation event shows up in the timeline
        self.go_to_timeline()
        tc.formvalue('prefs', 'ticket', True)
        tc.submit()
        tc.find('Ticket.*#%s.*created' % self.ticketcount)

        return self.ticketcount
Пример #19
0
 def go_to_query(self):
     """Surf to the custom query page."""
     self.go_to_front()
     tc.follow('View Tickets')
     tc.follow('Custom Query')
     tc.url(self.url + '/query')
Пример #20
0
 def go_to_admin(self):
     """Surf to the webadmin page."""
     self.go_to_front()
     tc.follow('\\bAdmin\\b')
Пример #21
0
 def go_to_roadmap(self):
     """Surf to the roadmap page."""
     self.go_to_front()
     tc.follow('\\bRoadmap\\b')
     tc.url(self.url + '/roadmap')
Пример #22
0
 def go_to_admin(self):
     """Surf to the webadmin page."""
     self.go_to_front()
     tc.follow('\\bAdmin\\b')
Пример #23
0
 def go_to_query(self):
     """Surf to the custom query page."""
     self.go_to_front()
     tc.follow('View Tickets')
     tc.follow('Custom Query')
     tc.url(self.url + '/query')
Пример #24
0
 def go_to_timeline(self):
     """Surf to the timeline page."""
     self.go_to_front()
     tc.follow('Timeline')
     tc.url(self.url + '/timeline')
Пример #25
0
 def go_to_query(self):
     """Surf to the custom query page."""
     self.go_to_front()
     tc.follow(r"\bView Tickets\b")
     tc.follow(r"\bNew Custom Query\b")
     tc.url(self.url + '/query')
Пример #26
0
 def go_to_milestone(self, name):
     """Surf to the specified milestone page. Assumes milestone exists."""
     self.go_to_roadmap()
     tc.follow(r"\bMilestone: %s\b" % name)
     tc.url(self.url + '/milestone/%s' % name)
Пример #27
0
 def go_to_roadmap(self):
     """Surf to the roadmap page."""
     self.go_to_front()
     tc.follow(r"\bRoadmap\b")
     tc.url(self.url + '/roadmap')
Пример #28
0
 def go_to_query(self):
     """Surf to the custom query page."""
     self.go_to_front()
     tc.follow(r"\bView Tickets\b")
     tc.follow(r"\bNew Custom Query\b")
     tc.url(self.url + '/query')
Пример #29
0
 def go_to_timeline(self):
     """Surf to the timeline page."""
     self.go_to_front()
     tc.follow(r"\bTimeline\b")
     tc.url(self.url + '/timeline')
Пример #30
0
 def logout(self):
     """Logout"""
     tc.follow("Logout")
     tc.notfind(internal_error)
Пример #31
0
 def logout(self):
     """Logout"""
     tc.follow("Logout")
     tc.notfind(internal_error)
Пример #32
0
 def go_to_milestone(self, name):
     """Surf to the specified milestone page. Assumes milestone exists."""
     self.go_to_roadmap()
     tc.follow('\\bMilestone: %s\\b' % name)
     tc.url(self.url + '/milestone/%s' % name)