internal/v4: refactor tests

We create a table with an entry for each kind of metadata so
that it's easy to add new entries and new tests that
test the metadata in arbitrary configurations without
writing reams of duplicated test code.

We also fix router so that it works correctly with
typed nil data, which avoids an if statement in
every metadata handler.
We can't just put the value here, because it varies according to the charm URL.

I can add some tests for the various endpoint get functions, but we do at least
currently check that they return non-nil (avoiding the most obvious pitfall).

I would prefer to avoid hard-coding the charm metadata from the charm/testing/repo
charms in this file.