Programming is not about writing lines of code, it is about solving problems for and from other people (customer, user, etc).
It happens that for programmers the solution takes the form of a program.
So it is why it is important to have problem solving capabilities and why it is tested.
That being said, I am not sure that solving tricky puzzle is the best way to assess someone.