Add some tests in api_test.go