Esempio n. 1
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.
        """
        # [BLOODHOUND] New Ticket => More fields (in create ticket menu)
        self.go_to_newticket()

        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)

        # [BLOODHOUND] no actual button to submit /newticket `propertyform`
        tc.submit()

        self._post_create_ticket()
        return self.ticketcount
Esempio n. 2
0
    def _attach_file_to_resource(self, realm, name, data=None,
                                 filename=None, description=None,
                                 replace=False, content_type=None):
        """Attaches a file to a resource. Assumes the resource exists and
           has already been navigated to."""

        if data is None:
            data = random_page()
        if description is None:
            description = random_sentence()
        if filename is None:
            filename = random_word()

        tc.submit('attachfilebutton', 'attachfile')
        tc.url(self.url + '/attachment/%s/%s/\\?action=new&'
                          'attachfilebutton=Attach\\+file$' % (realm, name))
        fp = StringIO(data)
        tc.formfile('attachment', 'attachment', filename,
                    content_type=content_type, fp=fp)
        tc.formvalue('attachment', 'description', description)
        if replace:
            tc.formvalue('attachment', 'replace', True)
        tc.submit()
        tc.url(self.url + '/attachment/%s/%s/$' % (realm, name))

        return filename
Esempio n. 3
0
    def _attach_file_to_resource(self,
                                 realm,
                                 name,
                                 data=None,
                                 filename=None,
                                 description=None,
                                 replace=False,
                                 content_type=None):
        """Attaches a file to a resource. Assumes the resource exists and
           has already been navigated to."""

        if data is None:
            data = random_page()
        if description is None:
            description = random_sentence()
        if filename is None:
            filename = random_word()

        tc.submit('attachfilebutton', 'attachfile')
        tc.url(self.url + r'/attachment/%s/%s/\?action=new$' % (realm, name))
        fp = io.BytesIO(data)
        tc.formfile('attachment',
                    'attachment',
                    filename,
                    content_type=content_type,
                    fp=fp)
        tc.formvalue('attachment', 'description', description)
        if replace:
            tc.formvalue('attachment', 'replace', True)
        tc.submit()
        tc.url(self.url + r'/attachment/%s/%s/$' % (realm, name))

        return filename
Esempio n. 4
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
Esempio n. 5
0
    def quick_create_ticket(self, summary=None, info=None):
        """Create a new (random) ticket in the test environment via quick
        create ticket shortcut. 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.  Fields are populated afterwards by
            navigating to ticket page, thereby ``info['summary']``overrides
            ``summary``.

        `summary` and `description` default to randomly-generated values.
        """
        self.go_to_front()
        tc.notfind(internal_error)

        if summary == None:
            summary = random_sentence(4)
        tc.formvalue('qct-form', 'field_summary', summary)
        tc.formvalue('qct-form', 'field_description', random_page())
        self._post_create_ticket()

        if info:
            # Second pass to update ticket fields
            tc.url(self.url + '/ticket/%s' % (self.ticketcount + 1))
            tc.notfind(internal_error)
            for field, value in info.items():
                tc.formvalue('inplace-propertyform', 'field_%s' % field, value)
            tc.submit('submit')

        return self.ticketcount
Esempio n. 6
0
    def attach_file_to_ticket(self,
                              ticketid,
                              data=None,
                              tempfilename=None,
                              description=None,
                              replace=False):
        """Attaches a file to the given ticket id, with random data if none is
        provided.  Assumes the ticket exists.
        """
        if data is None:
            data = random_page()
        if description is None:
            description = random_sentence()
        if tempfilename is None:
            tempfilename = random_word()

        self.go_to_ticket(ticketid)
        # set the value to what it already is, so that twill will know we
        # want this form.
        tc.formvalue('attachfile', 'action', 'new')
        tc.submit()
        tc.url(self.url + "/attachment/ticket/" \
               "%s/\\?action=new&attachfilebutton=Attach\\+file" % ticketid)
        fp = StringIO(data)
        tc.formfile('attachment', 'attachment', tempfilename, fp=fp)
        tc.formvalue('attachment', 'description', description)
        if replace:
            tc.formvalue('attachment', 'replace', True)
        tc.submit()
        tc.url(self.url + '/attachment/ticket/%s/$' % ticketid)
        return tempfilename
Esempio n. 7
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
Esempio n. 8
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.
        """
        # [BLOODHOUND] New Ticket => More fields (in create ticket menu)
        self.go_to_newticket()

        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)

        # [BLOODHOUND] no actual button to submit /newticket `propertyform`
        tc.submit()

        self._post_create_ticket()
        return self.ticketcount
Esempio n. 9
0
    def attach_file_to_ticket(self, ticketid, data=None, tempfilename=None,
                              description=None, replace=False,
                              content_type=None):
        """Attaches a file to the given ticket id, with random data if none is
        provided.  Assumes the ticket exists.
        """
        if data is None:
            data = random_page()
        if description is None:
            description = random_sentence()
        if tempfilename is None:
            tempfilename = random_word()

        self.go_to_ticket(ticketid)
        # set the value to what it already is, so that twill will know we
        # want this form.
        tc.formvalue('attachfile', 'action', 'new')
        tc.submit()
        tc.url(self.url + "/attachment/ticket/" \
               "%s/\\?action=new&attachfilebutton=Attach\\+file" % ticketid)
        fp = StringIO(data)
        tc.formfile('attachment', 'attachment', tempfilename,
                    content_type=content_type, fp=fp)
        tc.formvalue('attachment', 'description', description)
        if replace:
            tc.formvalue('attachment', 'replace', True)
        tc.submit()
        tc.url(self.url + '/attachment/ticket/%s/$' % ticketid)
        return tempfilename
Esempio n. 10
0
    def quick_create_ticket(self, summary=None, info=None):
        """Create a new (random) ticket in the test environment via quick
        create ticket shortcut. 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.  Fields are populated afterwards by
            navigating to ticket page, thereby ``info['summary']``overrides
            ``summary``.

        `summary` and `description` default to randomly-generated values.
        """
        self.go_to_front()
        tc.notfind(internal_error)

        if summary == None:
            summary = random_sentence(4)
        tc.formvalue('qct-form', 'field_summary', summary)
        tc.formvalue('qct-form', 'field_description', random_page())
        self._post_create_ticket()

        if info:
            # Second pass to update ticket fields
            tc.url(self.url + '/ticket/%s' % (self.ticketcount + 1))
            tc.notfind(internal_error)
            for field, value in info.items():
                tc.formvalue('inplace-propertyform', 'field_%s' % field, value)
            tc.submit('submit')

        return self.ticketcount
Esempio n. 11
0
    def edit_wiki_page(self, name, content=None):
        """Edits a wiki page, with random content is none is provided.
        Returns the content.
        """
        if content is None:
            content = random_page()
        self.go_to_wiki(name)
        tc.formvalue('modifypage', 'action', 'edit')
        tc.submit()
        tc.formvalue('edit', 'text', content)
        tc.submit('save')
        page_url = self.url + '/wiki/%s' % name
        tc.url(page_url + '$')

        return content
Esempio n. 12
0
    def edit_wiki_page(self, name, content=None, comment=None):
        """Edits a wiki page, with random content is none is provided.
        and a random comment if none is provided. Returns the content.
        """
        if content is None:
            content = random_page()
        if comment is None:
            comment = random_sentence()
        self.go_to_wiki(name)
        tc.submit(formname='modifypage')
        tc.formvalue('edit', 'text', content)
        tc.formvalue('edit', 'comment', comment)
        tc.submit('save')
        tc.url('%s/wiki/%s' % (self.url, name), regexp=False)

        return content
Esempio n. 13
0
    def edit_wiki_page(self, name, content=None, comment=None):
        """Edits a wiki page, with random content is none is provided.
        and a random comment if none is provided. Returns the content.
        """
        if content is None:
            content = random_page()
        if comment is None:
            comment = random_sentence()
        self.go_to_wiki(name)
        tc.formvalue('modifypage', 'action', 'edit')
        tc.submit()
        tc.formvalue('edit', 'text', content)
        tc.formvalue('edit', 'comment', comment)
        tc.submit('save')
        page_url = self.url + '/wiki/%s' % name
        tc.url(page_url+'$')

        return content
Esempio n. 14
0
 def attach_file_to_wiki(self, name, data=None):
     """Attaches a file to the given wiki page, with random content if none
     is provided.  Assumes the wiki page exists.
     """
     if data == None:
         data = random_page()
     self.go_to_wiki(name)
     # set the value to what it already is, so that twill will know we
     # want this form.
     tc.formvalue('attachfile', 'action', 'new')
     tc.submit()
     tc.url(self.url + "/attachment/wiki/" \
            "%s/\\?action=new&attachfilebutton=Attach\\+file" % name)
     tempfilename = random_word()
     fp = StringIO(data)
     tc.formfile('attachment', 'attachment', tempfilename, fp=fp)
     tc.formvalue('attachment', 'description', random_sentence())
     tc.submit()
     tc.url(self.url + '/attachment/wiki/%s/$' % name)
Esempio n. 15
0
 def attach_file_to_wiki(self, name, data=None):
     """Attaches a file to the given wiki page, with random content if none
     is provided.  Assumes the wiki page exists.
     """
     if data == None:
         data = random_page()
     self.go_to_wiki(name)
     # set the value to what it already is, so that twill will know we
     # want this form.
     tc.formvalue('attachfile', 'action', 'new')
     tc.submit()
     tc.url(self.url + "/attachment/wiki/" \
            "%s/\\?action=new&attachfilebutton=Attach\\+file" % name)
     tempfilename = random_word()
     fp = StringIO(data)
     tc.formfile('attachment', 'attachment', tempfilename, fp=fp)
     tc.formvalue('attachment', 'description', random_sentence())
     tc.submit()
     tc.url(self.url + '/attachment/wiki/%s/$' % name)
     return tempfilename
Esempio n. 16
0
 def runTest(self):
     """Test for regression of the timeline fix in r5883
     From Tim:
     the issue was that event.markup was never being output anywhere, so
     you actually have to render the template with a wiki modification
     and see if '(diff)' shows up as the text in a link
     also note that (diff) should _not_ show up for a wiki creation
     """
     pagename = random_unique_camel()
     self._tester.create_wiki_page(pagename)
     self._tester.go_to_timeline()
     tc.find(pagename)
     tc.notfind(pagename + '.*diff</a>\\)')
     self._tester.go_to_wiki(pagename)
     tc.submit(formname='modifypage')
     tc.find('Editing ' + pagename)
     tc.formvalue('edit', 'text', random_page())
     tc.formvalue('edit', 'comment', random_sentence())
     tc.submit('save')
     self._tester.go_to_timeline()
     tc.find(pagename + '.*diff</a>\\)')
Esempio n. 17
0
    def runTest(self):
        """Add a file to the repository and verify it is in the browser"""
        # Add a file to Subversion
        tempfilename = random_word() + '_repo_browse.txt'
        fulltempfilename = 'component1/trunk/' + tempfilename
        revision = self._testenv.svn_add(fulltempfilename, random_page())

        # Verify that it appears in the browser view:
        browser_url = self._tester.url + '/browser'
        self._tester.go_to_url(browser_url)
        tc.find('component1')
        tc.follow('component1')
        tc.follow('trunk')
        tc.follow(tempfilename)
        self._tester.quickjump('[%s]' % revision)
        tc.find('Changeset %s' % revision)
        tc.find('admin')
        tc.find('Add %s' % fulltempfilename)
        tc.find('1 added')
        tc.follow('Timeline')
        tc.find('Add %s' % fulltempfilename)
Esempio n. 18
0
 def runTest(self):
     """Test for regression of the timeline fix in r5883
     From Tim:
     the issue was that event.markup was never being output anywhere, so
     you actually have to render the template with a wiki modification
     and see if '(diff)' shows up as the text in a link
     also note that (diff) should _not_ show up for a wiki creation
     """
     pagename = random_unique_camel()
     self._tester.create_wiki_page(pagename)
     self._tester.go_to_timeline()
     tc.find(pagename)
     tc.notfind(pagename + '.*diff</a>\\)')
     self._tester.go_to_wiki(pagename)
     tc.formvalue('modifypage', 'action', 'edit')
     tc.submit()
     tc.find('Editing ' + pagename)
     tc.formvalue('edit', 'text', random_page())
     tc.formvalue('edit', 'comment', random_sentence())
     tc.submit('save')
     self._tester.go_to_timeline()
     tc.find(pagename + '.*diff</a>\\)')
Esempio n. 19
0
    def runTest(self):
        """Add a file to the repository and verify it is in the browser"""
        # Add a file to Subversion
        tempfilename = random_word() + '_repo_browse.txt'
        fulltempfilename = 'component1/trunk/' + tempfilename
        revision = self._testenv.svn_add(fulltempfilename, random_page())

        # Verify that it appears in the browser view:
        browser_url = self._tester.url + '/browser'
        tc.go(browser_url)
        tc.url(browser_url)
        tc.find('component1')
        tc.follow('component1')
        tc.follow('trunk')
        tc.follow(tempfilename)
        self._tester.quickjump('[%s]' % revision)
        tc.find('Changeset %s' % revision)
        tc.find('admin')
        tc.find('Add %s' % fulltempfilename)
        tc.find('1 added')
        tc.follow('Timeline')
        tc.find('Add %s' % fulltempfilename)
Esempio n. 20
0
    def runTest(self):
        """Add a file to the repository and verify it is in the browser"""
        # Add a file to Subversion
        tempfilename = random_word() + "_repo_browse.txt"
        fulltempfilename = "component1/trunk/" + tempfilename
        revision = self._testenv.svn_add(fulltempfilename, random_page())

        # Verify that it appears in the browser view:
        browser_url = self._tester.url + "/browser"
        tc.go(browser_url)
        tc.url(browser_url)
        tc.find("component1")
        tc.follow("component1")
        tc.follow("trunk")
        tc.follow(tempfilename)
        self._tester.quickjump("[%s]" % revision)
        tc.find("Changeset %s" % revision)
        tc.find("admin")
        tc.find("Add %s" % fulltempfilename)
        tc.find("1 added")
        tc.follow("Timeline")
        tc.find("Add %s" % fulltempfilename)
Esempio n. 21
0
    def create_wiki_page(self, page, content=None):
        """Creates the specified wiki page, with random content if none is
        provided.
        """
        if content == None:
            content = random_page()
        page_url = self.url + "/wiki/" + page
        tc.go(page_url)
        tc.url(page_url)
        tc.find("The page %s does not exist." % page)
        tc.formvalue('modifypage', 'action', 'edit')
        tc.submit()
        tc.url(page_url + '\\?action=edit')

        tc.formvalue('edit', 'text', content)
        tc.submit('save')
        tc.url(page_url+'$')

        # verify the event shows up in the timeline
        self.go_to_timeline()
        tc.formvalue('prefs', 'wiki', True)
        tc.submit()
        tc.find(page + ".*created")
Esempio n. 22
0
    def create_wiki_page(self, page, content=None):
        """Creates the specified wiki page, with random content if none is
        provided.
        """
        if content == None:
            content = random_page()
        page_url = self.url + "/wiki/" + page
        tc.go(page_url)
        tc.url(page_url)
        tc.find("The page %s does not exist." % page)
        tc.formvalue('modifypage', 'action', 'edit')
        tc.submit()
        tc.url(page_url + '\\?action=edit')

        tc.formvalue('edit', 'text', content)
        tc.submit('save')
        tc.url(page_url + '$')

        # verify the event shows up in the timeline
        self.go_to_timeline()
        tc.formvalue('prefs', 'wiki', True)
        tc.submit()
        tc.find(page + ".*created")
Esempio n. 23
0
    def create_wiki_page(self, name=None, content=None, comment=None):
        """Creates a wiki page, with a random unique CamelCase name if none
        is provided, random content if none is provided and a random comment
        if none is provided.  Returns the name of the wiki page.
        """
        if name is None:
            name = random_unique_camel()
        if content is None:
            content = random_page()
        self.go_to_wiki(name)
        tc.find("The page %s does not exist." % tag.strong(name))

        self.edit_wiki_page(name, content, comment)

        # verify the event shows up in the timeline
        self.go_to_timeline()
        tc.formvalue('prefs', 'wiki', True)
        tc.submit()
        tc.find(name + ".*created")

        self.go_to_wiki(name)

        return name
Esempio n. 24
0
    def create_wiki_page(self, name=None, content=None, comment=None):
        """Creates a wiki page, with a random unique CamelCase name if none
        is provided, random content if none is provided and a random comment
        if none is provided.  Returns the name of the wiki page.
        """
        if name is None:
            name = random_unique_camel()
        if content is None:
            content = random_page()
        self.go_to_wiki(name)
        tc.find("The page %s does not exist." % name)

        self.edit_wiki_page(name, content, comment)

        # verify the event shows up in the timeline
        self.go_to_timeline()
        tc.formvalue('prefs', 'wiki', True)
        tc.submit()
        tc.find(name + ".*created")

        self.go_to_wiki(name)

        return name