def test_change_error(self): change = pebble.Change( id=pebble.ChangeID('1234'), kind='start', summary='Start service "foo"', status='Done', tasks=[], ready=True, err=None, spawn_time=datetime.datetime.now(), ready_time=datetime.datetime.now(), ) error = pebble.ChangeError('Some error', change) self.assertIsInstance(error, pebble.Error) self.assertEqual(error.err, 'Some error') self.assertEqual(error.change, change) self.assertEqual(str(error), 'Some error')
def test_change_init(self): change = pebble.Change( id=pebble.ChangeID('70'), kind='autostart', err='SILLY', ready=True, ready_time=datetime_nzdt(2021, 1, 28, 14, 37, 4, 291517), spawn_time=datetime_nzdt(2021, 1, 28, 14, 37, 2, 247202), status='Done', summary='Autostart service "svc"', tasks=[], ) self.assertEqual(change.id, '70') self.assertEqual(change.kind, 'autostart') self.assertEqual(change.err, 'SILLY') self.assertEqual(change.ready, True) self.assertEqual(change.ready_time, datetime_nzdt(2021, 1, 28, 14, 37, 4, 291517)) self.assertEqual(change.spawn_time, datetime_nzdt(2021, 1, 28, 14, 37, 2, 247202)) self.assertEqual(change.status, 'Done') self.assertEqual(change.summary, 'Autostart service "svc"') self.assertEqual(change.tasks, [])