<commit_before>import webracer
from tests import utils
from tests import kitchen_sink_app

def setup_module():
    utils.start_bottle_server(kitchen_sink_app.app, 8052)

class SessionTest(webracer.WebTestCase):
    def test_get(self):
        s = webracer.Session()
        s.get('http://127.0.0.1:8052/ok')
        self.assertEqual(200, s.response.code)
        self.assertEqual('ok', s.response.body)
    
    def test_custom_user_agent(self):
        # XXX improve this api
        config = webracer.Config(user_agent='Quux-o-matic/1.0')
        s = webracer.Session(config)
        s.get('http://127.0.0.1:8052/get_user_agent')
        self.assertEqual(200, s.response.code)
        self.assertEqual('Quux-o-matic/1.0', s.response.body)
    
    def test_double_user_agent_override(self):
        # XXX improve this api
        config = webracer.Config(user_agent='Quux-o-matic/1.0')
        s = webracer.Session(config)
        headers = {'user-agent': 'Barlicious/2.0'}
        s.get('http://127.0.0.1:8052/get_user_agent', headers=headers)
        self.assertEqual(200, s.response.code)<commit_msg>Dry session test<commit_after>import webracer
from tests import utils
from tests import kitchen_sink_app

def setup_module():
    utils.start_bottle_server(kitchen_sink_app.app, 8052)

@webracer.config(host='localhost', port=8052)
class SessionTest(webracer.WebTestCase):
    def test_get(self):
        s = webracer.Session()
        s.get('/ok')
        self.assertEqual(200, s.response.code)
        self.assertEqual('ok', s.response.body)
    
    def test_custom_user_agent(self):
        # XXX improve this api
        config = webracer.Config(user_agent='Quux-o-matic/1.0')
        s = webracer.Session(config)
        s.get('/get_user_agent')
        self.assertEqual(200, s.response.code)
        self.assertEqual('Quux-o-matic/1.0', s.response.body)
    
    def test_double_user_agent_override(self):
        # XXX improve this api
        config = webracer.Config(user_agent='Quux-o-matic/1.0')
        s = webracer.Session(config)
        headers = {'user-agent': 'Barlicious/2.0'}
        s.get('/get_user_agent', headers=headers)
        self.assertEqual(200, s.response.code)
{'fraction_non_alphanumeric': 0.13114754098360656, 'fraction_numerical': 0.03460837887067395, 'mean_word_length': 3.0018214936247722, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 3, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '198228', 'n_tokens_mistral': 780, 'n_tokens_neox': 748, 'n_words': 117}