def test_get(self): request = webapp.Request({"wsgi.input": StringIO(), "CONTENT_LENGTH": 0, "METHOD": "GET", "PATH_INFO": "/"}) response = webapp.Response() handler = MainHandler() handler.initialize(request, response) handler.get() self.assertEqual(response.out.getvalue(), "Hello world!")
class RunSnipplets(object): def __init__(self, author, version, error_log): DIR = os.path.dirname(__file__) self.GLADE_DIR = os.path.join(DIR, "ui", "glade") + os.sep self.IMAGES_DIR = os.path.join(DIR, "ui", "images") + os.sep try: self.HOME_DIR = os.path.join(os.environ['HOME'], ".snipplets" + os.sep) except KeyError: #windows self.HOME_DIR = os.path.join(os.environ['HOMEPATH'], ".snipplets" + os.sep) try: os.mkdir(self.HOME_DIR) except: pass self.clipboard = gtk.Clipboard() self.db = db.DbSnipplet(self.HOME_DIR + "DEVsnippletsDB") #define codecompletion object here for use by all children self.code_syntax = highlight.HighLighter(self.db) self.create_main_window() self.tray_icon = gtk.StatusIcon() self.tray_icon.set_from_file(self.IMAGES_DIR + "snipplets.png") self.tray_icon.connect("activate", self.activate_menu, None) self.tray_icon.connect("popup-menu", self.popup_menu, None) self.wTree_menu = gtk.glade.XML(self.GLADE_DIR + "notification_menu") self.wTree_menu.signal_autoconnect(self) self.right_click_menu = self.wTree_menu.get_widget("status_menu") def activate_menu(self, *args): if self.main_window.window.props.visible: self.main_window.window.hide() else: self.main_window.window.show() def popup_menu(self, *args): self.right_click_menu.popup(parent_menu_shell=None, parent_menu_item=None, func=gtk.status_icon_position_menu, button=args[1], activate_time=args[2], data=self.tray_icon) def on_show_snipplets_activate(self, widget): self.main_window.window.present() def create_main_window(self): self.main_window = MainHandler(self, "snipplets.glade") def gtk_main_quit(self, widget=None): gtk.main_quit() def update_selection_view(self, data, id): self.main_window.update_selection_view(data, id) def create_new_snipplet_window(self, widget=None, id=None): self.create_new_window = CreateNewHandler(self, "create_new_snipplet.glade", id=id)
def test(self): handler = MainHandler() score = handler.testGet() self.failIf(score != 1)
def create_main_window(self): self.main_window = MainHandler(self, "snipplets.glade")