server: add unit tests

Make test coverage >= 90%

#1019 
len(action) = %d, want 1