<commit_before>from tests import PMGLiveServerTestCase
from tests.fixtures import (
    dbfixture, HouseData, CommitteeData
)


class TestEmailAlertsPage(PMGLiveServerTestCase):
    def setUp(self):
        super(TestEmailAlertsPage, self).setUp()

        self.fx = dbfixture.data(
            HouseData, CommitteeData,
        )
        self.fx.setup()

    def tearDown(self):
        self.fx.teardown()
        super(TestEmailAlertsPage, self).tearDown()

    def test_email_alerts_page(self):
        """
        Test email alerts page (/email-alerts)
        """
        self.get_page_contents("http://pmg.test:5000/email-alerts")
        self.assertIn('Which committees should we send you email alerts for?',
                      self.html)
        self.assertIn('National Assembly', self.html)
        self.assertIn(self.fx.CommitteeData.communications.name, self.html)
        self.assertIn('National Council of Provinces', self.html)
        self.assertIn('Provincial Legislatures Committees', self.html)
        self.assertIn(<commit_msg>Update test_email_alerts_page to use make_request<commit_after>from tests import PMGLiveServerTestCase
from tests.fixtures import (
    dbfixture, HouseData, CommitteeData
)


class TestEmailAlertsPage(PMGLiveServerTestCase):
    def setUp(self):
        super(TestEmailAlertsPage, self).setUp()

        self.fx = dbfixture.data(
            HouseData, CommitteeData,
        )
        self.fx.setup()

    def tearDown(self):
        self.fx.teardown()
        super(TestEmailAlertsPage, self).tearDown()

    def test_email_alerts_page(self):
        """
        Test email alerts page (/email-alerts)
        """
        self.make_request("/email-alerts", follow_redirects=True)
        self.assertIn('Which committees should we send you email alerts for?',
                      self.html)
        self.assertIn('National Assembly', self.html)
        self.assertIn(self.fx.CommitteeData.communications.name, self.html)
        self.assertIn('National Council of Provinces', self.html)
        self.assertIn('Provincial Legislatures Committees', self.html)
        self.assertIn(
{'fraction_non_alphanumeric': 0.1007497656982193, 'fraction_numerical': 0.0018744142455482662, 'mean_word_length': 2.805704099821747, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '2962253', 'n_tokens_mistral': 643, 'n_tokens_neox': 612, 'n_words': 122}