client.write(): only send `value` param if `value` is actually set.

`client.update()` calls to directories were failing because the client sends and empty `value` param with every `client.write()` call. This only sends a `value` param in `client.write()` if `value` is set, which fixes this.
add unit and integration tests
More stringent check on write()

Style changes to integration tests