Se api

Just for preview. Please don't merge it.
Most of these asserts should be replaced with returning an error code instead to just let xtest record the fact that this test failed.