Port old API tests for repositories

Completely rewrite existing tests in module `test_repository_v2`. Make them more
terse, efficent and thorough. Drop module `test_repository`, as the "v2" module
now performs its responsibilities.
Merge pull request #1427 from Ichimonji10/test-repository

Port old API tests for repositories