Beispiel #1
0
    def test_firefox_default(self):
        url = 'http://fox.example.com'
        target = self.config.target(url)

        with self.assertRaises(Exception) as context:
            browser(target, url).command()

        self.assertTrue(
            'Unsupported Browser: firefox' in str(context.exception))
Beispiel #2
0
 def test_strip_trailing_slash(self):
     url = 'https://gitlab.com/exampleuser/'
     target = self.config.target(url)
     command = browser(target, url).command()
     self.assertEqual(
         command,
         '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --profile-directory="Profile 2" "https://gitlab.com/exampleuser/" >> /dev/null &'
     )
Beispiel #3
0
 def test_https_schema(self):
     url = 'https://schema.example.com/johndoe/'
     target = self.config.target(url)
     command = browser(target, url).command()
     self.assertEqual(
         command,
         '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --profile-directory="Profile 2" "https://schema.example.com/johndoe/" >> /dev/null &'
     )
Beispiel #4
0
 def test_chrome_guest_overwrite_incognito(self):
     url = 'http://my-guest-not-incognito.example.com'
     target = self.config.target(url)
     command = browser(target, url).command()
     self.assertEqual(
         command,
         '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --guest "http://my-guest-not-incognito.example.com" >> /dev/null &'
     )
Beispiel #5
0
 def test_chrome_incognito(self):
     url = 'http://secret.example.com'
     target = self.config.target(url)
     command = browser(target, url).command()
     self.assertEqual(
         command,
         '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --profile-directory="Default" --incognito "http://secret.example.com" >> /dev/null &'
     )
Beispiel #6
0
 def test_start_null(self):
     url = 'http://www.bad-site.com/'
     target = self.config.target(url)
     command = browser(target, url).command()
     self.assertEqual(
         command,
         'echo "Url http://www.bad-site.com/ was not opened" >> /dev/null &'
     )
Beispiel #7
0
 def test_chrome_profile1(self):
     url = 'http://github.com/johndoe'
     target = self.config.target(url)
     command = browser(target, url).command()
     self.assertEqual(
         command,
         '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --profile-directory="Profile 1" "http://github.com/johndoe" >> /dev/null &'
     )
Beispiel #8
0
    def run(self, url):
        target = self.config.target(url)
        logging.getLogger('history').info("open: %s\t\turl: %s" %
                                          (target, url))
        command_to_execute = browser(target, url).command()
        logging.getLogger('application').info(command_to_execute)

        return os.system(command_to_execute)