correct error text

This commit is contained in:
Tim Bentley 2013-01-30 18:18:28 +00:00
parent 8f9b20a6cc
commit d72bc1b340
2 changed files with 27 additions and 17 deletions

View File

@ -30,14 +30,14 @@ class TestRegistry(TestCase):
with self.assertRaises(KeyError) as context: with self.assertRaises(KeyError) as context:
Registry().register(u'test1', mock_1) Registry().register(u'test1', mock_1)
self.assertEqual(context.exception[0], u'Duplicate service exception test1', self.assertEqual(context.exception[0], u'Duplicate service exception test1',
u'KeyError exception should have been thrown for [duplicate service|missing service|deleted service]') u'KeyError exception should have been thrown for duplicate service')
# WHEN I try to get back a non existent component # WHEN I try to get back a non existent component
# THEN I will get an exception # THEN I will get an exception
with self.assertRaises(KeyError) as context: with self.assertRaises(KeyError) as context:
temp = Registry().get(u'test2') temp = Registry().get(u'test2')
self.assertEqual(context.exception[0], u'Service test2 not found in list', self.assertEqual(context.exception[0], u'Service test2 not found in list',
u'KeyError exception should have been thrown for [duplicate service|missing service|deleted service]') u'KeyError exception should have been thrown for missing service')
# WHEN I try to replace a component I should be allowed (testing only) # WHEN I try to replace a component I should be allowed (testing only)
Registry().remove(u'test1') Registry().remove(u'test1')
@ -45,4 +45,4 @@ class TestRegistry(TestCase):
with self.assertRaises(KeyError) as context: with self.assertRaises(KeyError) as context:
temp = Registry().get(u'test1') temp = Registry().get(u'test1')
self.assertEqual(context.exception[0], u'Service test1 not found in list', self.assertEqual(context.exception[0], u'Service test1 not found in list',
u'KeyError exception should have been thrown for [duplicate service|missing service|deleted service]0') u'KeyError exception should have been thrown for deleted service')

View File

@ -33,18 +33,28 @@ class TestStartTimeDialog(TestCase):
""" """
Test StartTimeDialog are defaults correct Test StartTimeDialog are defaults correct
""" """
self.assertEqual(self.form.hourSpinBox.minimum(), 0) self.assertEqual(self.form.hourSpinBox.minimum(), 0, u'The minimum hour should stay the same as the dialog')
self.assertEqual(self.form.hourSpinBox.maximum(), 4) self.assertEqual(self.form.hourSpinBox.maximum(), 4, u'The maximum hour should stay the same as the dialog')
self.assertEqual(self.form.minuteSpinBox.minimum(), 0) self.assertEqual(self.form.minuteSpinBox.minimum(), 0,
self.assertEqual(self.form.minuteSpinBox.maximum(), 59) u'The minimum minute should stay the same as the dialog')
self.assertEqual(self.form.secondSpinBox.minimum(), 0) self.assertEqual(self.form.minuteSpinBox.maximum(), 59,
self.assertEqual(self.form.secondSpinBox.maximum(), 59) u'The maximum minute should stay the same as the dialog')
self.assertEqual(self.form.hourFinishSpinBox.minimum(), 0) self.assertEqual(self.form.secondSpinBox.minimum(), 0,
self.assertEqual(self.form.hourFinishSpinBox.maximum(), 4) u'The minimum second should stay the same as the dialog')
self.assertEqual(self.form.minuteFinishSpinBox.minimum(), 0) self.assertEqual(self.form.secondSpinBox.maximum(), 59,
self.assertEqual(self.form.minuteFinishSpinBox.maximum(), 59) u'The maximum second should stay the same as the dialog')
self.assertEqual(self.form.secondFinishSpinBox.minimum(), 0) self.assertEqual(self.form.hourFinishSpinBox.minimum(), 0,
self.assertEqual(self.form.secondFinishSpinBox.maximum(), 59) u'The minimum finish hour should stay the same as the dialog')
self.assertEqual(self.form.hourFinishSpinBox.maximum(), 4,
u'The maximum finish hour should stay the same as the dialog')
self.assertEqual(self.form.minuteFinishSpinBox.minimum(), 0,
u'The minimum finish minute should stay the same as the dialog')
self.assertEqual(self.form.minuteFinishSpinBox.maximum(), 59,
u'The maximum finish minute should stay the same as the dialog')
self.assertEqual(self.form.secondFinishSpinBox.minimum(), 0,
u'The minimum finish second should stay the same as the dialog')
self.assertEqual(self.form.secondFinishSpinBox.maximum(), 59,
u'The maximum finish second should stay the same as the dialog')
def time_display_test(self): def time_display_test(self):
""" """
@ -67,7 +77,7 @@ class TestStartTimeDialog(TestCase):
self.assertEqual(self.form.hourSpinBox.value(), 0) self.assertEqual(self.form.hourSpinBox.value(), 0)
self.assertEqual(self.form.minuteSpinBox.value(), 1) self.assertEqual(self.form.minuteSpinBox.value(), 1)
self.assertEqual(self.form.secondSpinBox.value(), 1) self.assertEqual(self.form.secondSpinBox.value(), 1)
self.assertEqual(self.form.item[u'service_item'].start_time, 61, u'The start time has not changed') self.assertEqual(self.form.item[u'service_item'].start_time, 61, u'The start time should stay the same')
# WHEN displaying the UI, changing the time to 2min 3secs and pressing enter # WHEN displaying the UI, changing the time to 2min 3secs and pressing enter
self.form.item = {u'service_item': mocked_serviceitem} self.form.item = {u'service_item': mocked_serviceitem}
@ -82,4 +92,4 @@ class TestStartTimeDialog(TestCase):
self.assertEqual(self.form.hourSpinBox.value(), 0) self.assertEqual(self.form.hourSpinBox.value(), 0)
self.assertEqual(self.form.minuteSpinBox.value(), 2) self.assertEqual(self.form.minuteSpinBox.value(), 2)
self.assertEqual(self.form.secondSpinBox.value(), 3) self.assertEqual(self.form.secondSpinBox.value(), 3)
self.assertEqual(self.form.item[u'service_item'].start_time, 123, u'The start time has changed') self.assertEqual(self.form.item[u'service_item'].start_time, 123, u'The start time should have changed')