<commit_before>import owebunit
from wolis import utils
from wolis.test_case import WolisTestCase

class RegisterTestCase(WolisTestCase):
    def test_register(self):
        self.get('/ucp.php?mode=register')
        self.assert_successish()
        
        assert 'Registration' in self.response.body
        
        form = self.response.form(id='agreement')
        elements = form.elements.mutable
        elements.submit('agreed')
        self.post(form.computed_action, body=elements.params.list)
        self.assert_successish()
        
        assert 'Username:' in self.response.body
        
        form = self.response.form(id='register')
        # for repeated runs
        suffix = self.random_suffix()
        params = {
            'username': 'test' + suffix,
            'new_password': '<PASSWORD>',
            'password_confirm': '<PASSWORD>',
            'email': '<EMAIL>' % suffix,
            'lang': 'en',
            'tz': 'UTC',
            'confirm_id': '',
            'confirm_code': '',
        }
        
        if self.phpbb_version < (3, 1, 0):
            params['email_confirm'] = params['email']
        
        self.check_form_key_delay()
        
        elements = form.elements.mutable
        elements.submit('submit')
        params = owebunit.extend_params(elements.params.dict, params)
        self.post(form.computed_action, body=params)
        self.assert_successish()
        
        assert 'Registration' not in self.response.body
        assert 'Thank you for registering' in self.response.body
        # check that there are no further actions needed
        assert 'You may now login with your username' in self.response.body
    
    @utils.restrict_phpbb_version('>=3.1.0')
    def test_initial_timezone_ascreus(self):
        self.get('/ucp.php?mode=register&agreed=yes')
        #self.post('/ucp.php?mode=register', body=dict(agreed='yes'))
        self.assert_successish()
        
        assert 'Username:' in self.response.body
        
        form = self.response.form(id='register')
        assert form.params.dict['tz_date'].startswith('GMT+11:00')
        
        #doc = self.response.lxml_etree
        #timezone_select = owebunit.utils.xpath_first_check(doc, 'select[@id="timezone"]')
<commit_msg>Typo fix<commit_after>import owebunit
from wolis import utils
from wolis.test_case import WolisTestCase

class RegisterTestCase(WolisTestCase):
    def test_register(self):
        self.get('/ucp.php?mode=register')
        self.assert_successish()
        
        assert 'Registration' in self.response.body
        
        form = self.response.form(id='agreement')
        elements = form.elements.mutable
        elements.submit('agreed')
        self.post(form.computed_action, body=elements.params.list)
        self.assert_successish()
        
        assert 'Username:' in self.response.body
        
        form = self.response.form(id='register')
        # for repeated runs
        suffix = self.random_suffix()
        params = {
            'username': 'test' + suffix,
            'new_password': '<PASSWORD>',
            'password_confirm': '<PASSWORD>',
            'email': '<EMAIL>' % suffix,
            'lang': 'en',
            'tz': 'UTC',
            'confirm_id': '',
            'confirm_code': '',
        }
        
        if self.phpbb_version < (3, 1, 0):
            params['email_confirm'] = params['email']
        
        self.check_form_key_delay()
        
        elements = form.elements.mutable
        elements.submit('submit')
        params = owebunit.extend_params(elements.params.dict, params)
        self.post(form.computed_action, body=params)
        self.assert_successish()
        
        assert 'Registration' not in self.response.body
        assert 'Thank you for registering' in self.response.body
        # check that there are no further actions needed
        assert 'You may now login with your username' in self.response.body
    
    @utils.restrict_phpbb_version('>=3.1.0')
    def test_initial_timezone_ascraeus(self):
        self.get('/ucp.php?mode=register&agreed=yes')
        #self.post('/ucp.php?mode=register', body=dict(agreed='yes'))
        self.assert_successish()
        
        assert 'Username:' in self.response.body
        
        form = self.response.form(id='register')
        assert form.params.dict['tz_date'].startswith('GMT+11:00')
        
        #doc = self.response.lxml_etree
        #timezone_select = owebunit.utils.xpath_first_check(doc, 'select[@id="timezone"]')

{'fraction_non_alphanumeric': 0.1211453744493392, 'fraction_numerical': 0.004405286343612335, 'mean_word_length': 2.2763347763347763, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, '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': '1501273', 'n_tokens_mistral': 1318, 'n_tokens_neox': 1306, 'n_words': 247}