Пример #1
0
 def test_invalid_run_number_get_params(self):
     """An invalid/empty run GET parameter should redirect to the default."""
     doc1 = self.get('/run_view/?run=')
     doc2 = self.get('/run_view/?run=abc!')
     number_header1 = doc1.cssselect('.run-number')[0].text_content()
     number_header2 = doc2.cssselect('.run-number')[0].text_content()
     self.assertIn('Run #{0}'.format(run_view.default_run()), number_header1)
     self.assertIn('Run #{0}'.format(run_view.default_run()), number_header2)
Пример #2
0
 def test_invalid_run_number_get_params(self):
     """An invalid/empty run GET parameter should redirect to the default."""
     doc1 = self.get('/run_view/?run=')
     doc2 = self.get('/run_view/?run=abc!')
     number_header1 = doc1.cssselect('.run-number')[0].text_content()
     number_header2 = doc2.cssselect('.run-number')[0].text_content()
     self.assertIn('Run #{0}'.format(run_view.default_run()),
                   number_header1)
     self.assertIn('Run #{0}'.format(run_view.default_run()),
                   number_header2)
Пример #3
0
 def test_invalid_run(self):
     """Invalid run numbers show a warning, redirecting to the default"""
     invalid_run = 123
     doc = self.get('/run_view/{0}'.format(invalid_run))
     number_header = doc.cssselect('.run-number')[0].text_content()
     alert = doc.cssselect('.alert')[0].text_content()
     self.assertIn('Invalid run number "{0}"'.format(invalid_run), alert)
     self.assertIn('Run #{0}'.format(run_view.default_run()), number_header)
Пример #4
0
 def test_invalid_run(self):
     """Invalid run numbers show a warning, redirecting to the default"""
     invalid_run = 123
     doc = self.get('/run_view/{0}'.format(invalid_run))
     number_header = doc.cssselect('.run-number')[0].text_content()
     alert = doc.cssselect('.alert')[0].text_content()
     self.assertIn('Invalid run number "{0}"'.format(invalid_run), alert)
     self.assertIn('Run #{0}'.format(run_view.default_run()), number_header)
Пример #5
0
 def test_invalid_sensor_numbers(self):
     """Invalid sensor numbers should be set to zero and an error shown."""
     sensor = 999
     run = run_view.default_run()
     doc = self.get('/run_view/{0}/other_page/{1}'.format(run, sensor))
     alert = doc.cssselect('.alert')[0].text_content()
     self.assertIn('Invalid sensor number "{0}"'.format(sensor), alert)
     field = doc.cssselect('.run-view-pane:first-child .sensor-selector input')[0]
     self.assertEqual(field.value, '0')
Пример #6
0
 def test_invalid_sensor_numbers(self):
     """Invalid sensor numbers should be set to zero and an error shown."""
     sensor = 999
     run = run_view.default_run()
     doc = self.get('/run_view/{0}/other_page/{1}'.format(run, sensor))
     alert = doc.cssselect('.alert')[0].text_content()
     self.assertIn('Invalid sensor number "{0}"'.format(sensor), alert)
     field = doc.cssselect(
         '.run-view-pane:first-child .sensor-selector input')[0]
     self.assertEqual(field.value, '0')
Пример #7
0
 def test_default_run(self):
     """Run number should be set to zero if none is specified."""
     doc = self.get('/run_view')
     number_header = doc.cssselect('.run-number')[0].text_content()
     self.assertIn('Run #{0}'.format(run_view.default_run()), number_header)
Пример #8
0
 def test_default_run(self):
     """Run number should be set to zero if none is specified."""
     doc = self.get('/run_view')
     number_header = doc.cssselect('.run-number')[0].text_content()
     self.assertIn('Run #{0}'.format(run_view.default_run()), number_header)