Beispiel #1
0
    def test_sort_providers(self):
        ch = cc.ConfigHolder()
        ch.providers.append(cc.ConfigHolder.Provider('Google', 'https://www.google.com/search?tbm=isch&q={}'))
        ch.providers.append(cc.ConfigHolder.Provider('Amazon', 'http://amazon.com/{}?direct_search_result=yes'))
        ch.providers.append(cc.ConfigHolder.Provider('Facebook', 'https://www.facebook.com/{}'))
        self._tested.sortProviders(ch)

        self.assertEqual(ch.providers[0].name, 'Amazon')
        self.assertEqual(ch.providers[1].name, 'Facebook')
Beispiel #2
0
    def test_move_providerUp(self):
        ch = cc.ConfigHolder()
        ch.providers.append(cc.ConfigHolder.Provider('Google', 'https://www.google.com/search?tbm=isch&q={}'))
        ch.providers.append(cc.ConfigHolder.Provider('Amazon', 'http://amazon.com/{}?direct_search_result=yes'))
        ch.providers.append(cc.ConfigHolder.Provider('Facebook', 'https://www.facebook.com/{}'))

        self._tested.moveProvider(ch, 0, True)      # do nothing
        self.assertEqual(ch.providers[0].name, 'Google')

        self._tested.moveProvider(ch, 2, True)      # do nothing
        self.assertEqual(ch.providers[1].name, 'Facebook')
Beispiel #3
0
    def test_validation(self):
        c = cc.ConfigHolder(browserAlwaysOnTop=True)
        self._tested.validate(c)
        try:
            c2 = 'Error'
            self._tested.validate(c2)
            self.fail() # exception expected
        except:
            pass
        
        try:
            c2 = cc.ConfigHolder()
            c2.providers = ['Oh no!']
            self._tested.validate(c2)
            self.fail() # exception expected
        except:
            pass

        try:
            c2 = cc.ConfigHolder(keepBrowserOpened='Now as string')
            self._tested.validate(c2)
            self.fail() # exception expected
        except:
            pass
Beispiel #4
0
 def test_valid_urls(self):
     ch = cc.ConfigHolder()
     ch.providers.append(cc.ConfigHolder.Provider('Google', 'https://www.google.com/search?tbm=isch&q={}'))
     ch.providers.append(cc.ConfigHolder.Provider('Sentence', 'http://sentence.yourdictionary.com/{}?direct_search_result=yes'))
     ch.providers.append(cc.ConfigHolder.Provider('issues#5', 'https://www.google.co.jp/search?tbm=isch&q={}+アニメ美少女'))
     self._tested.validate(ch)
Beispiel #5
0
 def test_getInitialWindowSizeInvalid(self):
     ch = cc.ConfigHolder(initialBrowserSize="3030-30")
     self._tested._config = ch
     result = self._tested.getInitialWindowSize()
     self.assertEqual(850, result[0])
     self.assertEqual(500, result[1])
Beispiel #6
0
 def test_getInitialWindowSizeOk(self):
     ch = cc.ConfigHolder(initialBrowserSize="5050x30")
     self._tested._config = ch
     result = self._tested.getInitialWindowSize()
     self.assertEqual(5050, result[0])
     self.assertEqual(30, result[1])