old_contents: #!/usr/bin/env python3
  """
  Meerkat Frontend Tests
  
  Unit tests for the Meerkat frontend
  """
  import meerkat_frontend
  import unittest
  try:
      import simplejson as json
  except ImportError:
      import json
  import urllib.parse
  
  
  class MeerkatFrontendTestCase(unittest.TestCase):
  
      def setUp(self):
          """Setup for testing"""
          meerkat_frontend.app.config['TESTING'] = True
          self.app = meerkat_frontend.app.test_client()
  
      def tearDown(self):
          pass
  
      def test_index(self):
          """Check the index page loads"""
          rv = self.app.get('/')
          assert '200 OK' in rv.status
          assert b'WHO' in rv.data
  
      def test_reports(self):
          """Check the Reports page loads"""
          rv = self.app.get('/reports/')
          assert '200 OK' or '302 FOUND' in rv.status
  
      def test_technical(self):
          """Check the Technical page loads"""
          rv = self.app.get('/technical/')
          assert '200 OK' in rv.status
  
  
  if __name__ == '__main__':
      unittest.main()
  
new_contents: #!/usr/bin/env python3
  """
  Meerkat Frontend Tests
  
  Unit tests for the Meerkat frontend
  """
  import meerkat_frontend as mk
  import unittest
  from datetime import datetime
  
  
  class MeerkatFrontendTestCase(unittest.TestCase):
  
      def setUp(self):
          """Setup for testing"""
          mk.app.config['TESTING'] = True
          self.app = mk.app.test_client()
  
      def tearDown(self):
          pass
  
      def test_index(self):
          """Check the index page loads"""
          rv = self.app.get('/')
          self.assertEqual(rv.status_code, 200)
          self.assertIn(b'WHO', rv.data)
  
      def test_reports(self):
          """Check the Reports page loads"""
          rv = self.app.get('/reports/')
          self.assertIn(rv.status_code, [200, 302])
  
      def test_technical(self):
          """Check the Technical page loads"""
          rv = self.app.get('/technical/')
          self.assertEqual(rv.status_code, 200)
  
      # Utility FUNCTIONS
      def test_epi_week_to_date(self):
          """Ensure epi_week_to_date is sane"""
          self.assertEqual(
              mk.views.reports.epi_week_to_date(42, year=2015),
              datetime(2015, 10, 22)
          )
          self.assertEqual(
              mk.views.reports.epi_week_to_date(12, year=2023),
              datetime(2023, 3, 26)
          )
          self.assertEqual(
              mk.views.reports.epi_week_to_date(4, year=2008),
              datetime(2008, 1, 29)
          )
  
      def test_date_to_epi_week(self):
          """Ensure date_to_epi_week is sane"""
          self.assertEqual(
              mk.views.reports.date_to_epi_week(datetime(2008, 1, 27)),
              4
          )
          self.assertEqual(
              mk.views.reports.date_to_epi_week(datetime(2023, 3, 25)),
              12
          )
          self.assertEqual(
              mk.views.reports.date_to_epi_week(datetime(2015, 10, 26)),
              43
          )
  
  
  if __name__ == '__main__':
      unittest.main()
  
subject: Revise unit tests