Generalize endpoint extension

Use a proper test framework & mock, etc.