'Callbacks can be registered that are called every time there is a
change saved.'

def test_register_for_callback(self):

    service = self.service(FilePath(self.mktemp()))
    callbacks = []
    callbacks2 = []
    service.register((lambda : callbacks.append(1)))
    d = service.save(LATEST_TEST_DEPLOYMENT)
    def saved(_):
        service.register((lambda : callbacks2.append(1)))
        uuid = uuid4()
        changed = LATEST_TEST_DEPLOYMENT.transform(('nodes', uuid), Node(uuid=uuid))
        return service.save(changed)
    d.addCallback(saved)
    def saved_again(_):
        self.assertEqual((callbacks, callbacks2), ([1, 1], [1]))
    d.addCallback(saved_again)
    return d
