<s> from cabu . tests . test_base import TestBase <EOL> from cabu . utils . headers import Headers <EOL> from mock import patch <EOL> from selenium . webdriver . common . desired_capabilities import DesiredCapabilities <EOL> from selenium import webdriver <EOL> class TestHeaders ( TestBase ) : <EOL> def setUp ( self ) : <EOL> super ( TestHeaders , self ) . setUp ( ) <EOL> self . patcher_phantomjs = patch ( '<STR_LIT>' , spec = True ) <EOL> self . patcher_phantomjs . start ( ) <EOL> self . config = self . app . config <EOL> self . config [ '<STR_LIT>' ] = { <EOL> '<STR_LIT>' : <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> } <EOL> def tearDown ( self ) : <EOL> super ( TestHeaders , self ) . setUp ( ) <EOL> self . patcher_phantomjs . stop ( ) <EOL> def test_firefox_headers_loading ( self ) : <EOL> self . app . config [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> profile = webdriver . FirefoxProfile ( ) <EOL> headers = Headers ( self . app . config ) <EOL> profile = headers . set_headers ( profile ) <EOL> self . assertEquals ( <EOL> profile . __dict__ [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> def test_phantomjs_headers_loading ( self ) : <EOL> dcap = dict ( DesiredCapabilities . PHANTOMJS ) <EOL> headers = Headers ( self . config ) . set_headers ( dcap ) <EOL> self . assertEquals ( <EOL> headers [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> def test_chrome_headers_loading ( self ) : <EOL> self . app . config [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> dcap = dict ( DesiredCapabilities . PHANTOMJS ) <EOL> with self . assertRaises ( Exception ) : <EOL> Headers ( self . config ) . set_headers ( dcap ) </s>
