Ejemplo n.º 1
0
    def test_OverrideAppPath(self):
        app = schmowser.Schmowser(discover_apps=False)

        ret = app.add_app('MyApp', '/Applications/Safari.app')
        self.assertTrue(ret)

        ret = app.add_app('MyApp', '/Applications/Safari.app')
        self.assertTrue(ret)
Ejemplo n.º 2
0
    def test_BadAppName(self):
        app = schmowser.Schmowser(discover_apps=False)

        # make sure we can add Safari properly...
        ret = app.add_app('Safari', '/Applications/Safari.app')
        self.assertTrue(ret)

        # now try to use a bad appname
        ret = app.add_app(None, '/Applications/Safari.app')
        self.assertFalse(ret)
Ejemplo n.º 3
0
    def test_BasicAppMatch(self):
        app = schmowser.Schmowser(discover_apps=False)
        app.add_app('Foo', '/usr/bin/true')
        app.add_handler('^http://.*foo.*$', 'Foo')

        good_name = app.get_app_name('http://www.foo.com/')
        self.assertEqual(good_name, 'Foo')

        bad_name = app.get_app_name('http://www.bar.com/')
        self.assertNotEqual(bad_name, 'Foo')
Ejemplo n.º 4
0
 def test_NoSuchAppForHandler(self):
     app = schmowser.Schmowser(discover_apps=False)
     ret = app.add_handler('*', 'NoSuchApp')
     self.assertFalse(ret)
Ejemplo n.º 5
0
 def test_BadAppPath(self):
     app = schmowser.Schmowser(discover_apps=False)
     ret = app.add_app('Foo', '/tmp/bad_file_name.app')
     self.assertFalse(ret)
Ejemplo n.º 6
0
 def test_DiscoverAppsDefaultName(self):
     app = schmowser.Schmowser()
     app_name = app.get_app_name('http://www.foo.com/')
     self.assertIsNotNone(app_name)
Ejemplo n.º 7
0
 def test_EmptyAppsDefaultName(self):
     app = schmowser.Schmowser(discover_apps=False)
     app_name = app.get_app_name('http://www.foo.com/')
     self.assertIsNone(app_name)