Welcome to Bugsy!¶
Bugsy is a tool that allows you to programmatically work with Bugzilla using its native REST API.
To use you will do
import bugsy
bugzilla = bugsy.Bugsy()
bug = bugzilla.get(123456)
bug123456.status = 'RESOLVED'
bug123456.resolution = 'FIXED'
bugzilla.put(bug123456)
Installing Bugsy¶
To install Bugsy, simply run this simple command in your terminal of choice
Pip
pip install bugsy
If you don’t have pip installed then do
easy_install
easy_install pip
pip install bugsy
Bugsy is actively developed on GitHub, where the code is always available.
You can either clone the public repository:
$ git clone git://github.com/AutomatedTester/bugsy.git
Or, download the tarball:
Once you have a copy of the source, you can embed it in your own Python package, or install it into your site-packages easily:
Using Bugsy¶
Getting a bug from Bugzilla¶
Getting a bug is quite simple. Create a Bugsy object and then get the bug number that you want.
import bugsy
bugzilla = bugsy.Bugsy()
bug = bugzilla.get(123456)
Creating a new bug¶
To create a new bug, create a Bug object, populate it with the items that you need and then use the Bugsy object to put the bug into Bugzilla
import bugsy
bug = bugsy.Bug()
bug.summary = "I really realy love cheese"
bug.add_comment("and I really want sausages with it!")
bugzilla = bugsy.Bugsy("username", "password")
bugzilla.put(bug)
bug.id #returns the bug id from Bugzilla
Searching Bugzilla¶
To search for bugs you will need to create a Bugsy
object and then you can call
search_for and chain the search. The Search
API is a Fluent API
- you just chain the items that you need and then call search when the search is complete.
import bugsy
bugzilla = bugsy.Bugsy()
bugs = bugzilla.search_for\
.keywords("checkin-needed")\
.include_fields("flags")\
.search()
More details can be found in from the Search
class
Comments¶
Getting comments from a bug
import bugsy
bugzilla = bugsy.Bugsy()
bug = bugzilla.get(123456)
comments = bug.get_comments()
comments[0].text # Returns "I <3 Sausages"
Adding comments to a bug
import bugsy
bugzilla = bugsy.Bugsy()
bug = bugzilla.get(123456)
bug.add_comment("And I love bacon too!")
To see further details look at: