Esempio n. 1
0
 def test(c):
     options = make_options(c)
     m = Mocker()
     tv = m.mock(ak.NSTextView)
     finder_cls = m.replace("editxt.command.find.Finder")
     save_paste = m.replace(mod, "save_to_find_pasteboard")
     def check_options(get_tv, args):
         eq_(get_tv(), tv)
         eq_(args, options)
     finder = m.mock(Finder)
     save_paste(c.find)
     (finder_cls(ANY, ANY) << finder).call(check_options)
     getattr(finder, c.action)("<sender>") >> c.message
     with m:
         args = mod.find.arg_parser.parse(c.input)
         result = mod.find(tv, "<sender>", args)
         eq_(result, c.message)
Esempio n. 2
0
    def test(c):
        options = make_options(c)
        m = Mocker()
        tv = m.mock(ak.NSTextView)
        finder_cls = m.replace("editxt.command.find.Finder")
        save_paste = m.replace(mod, "save_to_find_pasteboard")

        def check_options(get_tv, args):
            eq_(get_tv(), tv)
            eq_(args, options)

        finder = m.mock(Finder)
        save_paste(c.find)
        (finder_cls(ANY, ANY) << finder).call(check_options)
        getattr(finder, c.action)("<sender>") >> c.message
        with m:
            args = mod.find.arg_parser.parse(c.input)
            result = mod.find(tv, "<sender>", args)
            eq_(result, c.message)
Esempio n. 3
0
 def test(c):
     m = Mocker()
     app = m.mock('editxt.application.Application')
     options = make_options(c)
     options.app = app
     editor = m.mock(Editor)
     editor.app >> app
     finder_cls = m.replace("editxt.command.find.Finder")
     save_paste = m.replace(mod, "save_to_find_pasteboard")
     def check_options(get_editor, args, app):
         eq_(get_editor(), editor)
         eq_(args, options)
     finder = m.mock(Finder)
     save_paste(c.find)
     (finder_cls(ANY, ANY, app) << finder).call(check_options)
     getattr(finder, c.action)(None) >> c.message
     with m:
         args = mod.find.arg_parser.parse(c.input)
         result = mod.find(editor, args)
         eq_(result, c.message)