Example #1
0
 def test_save_same_result_again(self):
     """Save a previously saved result. Expected is an IntegrityError"""
     modified_data = copy.deepcopy(self.data1)
     modified_data['environment'] = "Dual Core"
     bundle = ResultBundle(**modified_data)
     bundle._populate_obj_by_data()
     self.assertRaises(IntegrityError, bundle.save)
Example #2
0
 def test_save_same_result_again(self):
     """Save a previously saved result. Expected is an IntegrityError"""
     modified_data = copy.deepcopy(self.data1)
     modified_data['environment'] = "Dual Core"
     bundle = ResultBundle(**modified_data)
     bundle._populate_obj_by_data()
     self.assertRaises(IntegrityError, bundle.save)
Example #3
0
 def test_optional_data(self):
     """Check handling of optional data"""
     data = dict(self.data1.items() + self.data_optional.items())
     bundle = ResultBundle(**data)
     bundle.save()
     self.assertIsInstance(bundle.obj.date, datetime)
     self.assertEqual(bundle.obj.std_dev,
                      float(self.data_optional['std_dev']))
     self.assertEqual(bundle.obj.val_max,
                      float(self.data_optional['val_max']))
     self.assertEqual(bundle.obj.val_min,
                      float(self.data_optional['val_min']))
Example #4
0
 def test_optional_data(self):
     """Check handling of optional data"""
     data = dict(self.data1.items() + self.data_optional.items())
     bundle = ResultBundle(**data)
     bundle.save()
     self.assertIsInstance(bundle.obj.date, datetime)
     self.assertEqual(bundle.obj.std_dev,
                      float(self.data_optional['std_dev']))
     self.assertEqual(bundle.obj.val_max,
                      float(self.data_optional['val_max']))
     self.assertEqual(bundle.obj.val_min,
                      float(self.data_optional['val_min']))
Example #5
0
 def test_non_exiting_items(self):
     """Check handling of optional data"""
     modified_data = copy.deepcopy(self.data1)
     modified_data['commitid'] = '0b31bf33a469ac2cb1949666eea54d69a36c3724'
     modified_data['project'] = 'Cython'
     modified_data['benchmark'] = 'Django Template'
     modified_data['executable'] = 'pypy-jit'
     bundle = ResultBundle(**modified_data)
     bundle.save()
     self.assertEqual(bundle.obj.revision.commitid,
                      modified_data['commitid'])
     self.assertEqual(bundle.obj.benchmark.name, modified_data['benchmark'])
     self.assertEqual(bundle.obj.project.name, modified_data['project'])
Example #6
0
 def test_date_attr_set(self):
     """Check if date attr of Result() is set if not given"""
     # date is set automatically
     modified_data = copy.deepcopy(self.data1)
     bundle = ResultBundle(**modified_data)
     bundle.save()
     self.assertIsInstance(bundle.obj.date, datetime)
     # date set by value
     modified_data['date'] = '2011-05-05 03:01:45'
     ResultBundle(**modified_data)
     # wrong date string
     modified_data['date'] = '2011-05-05T03:01:45'
     self.assertRaises(ImmediateHttpResponse, ResultBundle, **modified_data)
Example #7
0
 def test_date_attr_set(self):
     """Check if date attr of Result() is set if not given"""
     # date is set automatically
     modified_data = copy.deepcopy(self.data1)
     bundle = ResultBundle(**modified_data)
     bundle.save()
     self.assertIsInstance(bundle.obj.date, datetime)
     # date set by value
     modified_data['date'] = '2011-05-05 03:01:45'
     ResultBundle(**modified_data)
     # wrong date string
     modified_data['date'] = '2011-05-05T03:01:45'
     self.assertRaises(ImmediateHttpResponse, ResultBundle, **modified_data)
Example #8
0
 def test_non_exiting_items(self):
     """Check handling of optional data"""
     modified_data = copy.deepcopy(self.data1)
     modified_data['commitid'] = '0b31bf33a469ac2cb1949666eea54d69a36c3724'
     modified_data['project'] = 'Cython'
     modified_data['benchmark'] = 'Django Template'
     modified_data['executable'] = 'pypy-jit'
     bundle = ResultBundle(**modified_data)
     bundle.save()
     self.assertEqual(bundle.obj.revision.commitid,
                      modified_data['commitid'])
     self.assertEqual(bundle.obj.benchmark.name,
                      modified_data['benchmark'])
     self.assertEqual(bundle.obj.project.name,
                      modified_data['project'])
Example #9
0
 def test_populate_and_save(self):
     bundle = ResultBundle(**self.data1)
     bundle._populate_obj_by_data()
     # should raise exception if not OK
     bundle.save()
     self.assert_(True)
Example #10
0
 def test_populate_and_save(self):
     bundle = ResultBundle(**self.data1)
     bundle._populate_obj_by_data()
     # should raise exception if not OK
     bundle.save()
     self.assert_(True)