HomeSoftware Heritage

tests: Migrate to pytest and cleanup

Description

tests: Migrate to pytest and cleanup

Migrate all swh-web unit tests from unittest to pure pytest which
implies the following:

  • all tests are turned from a class method to a simple function
  • replace previous assertions from unittest.TestCase to simple calls to Python assert
  • previous features offered by the former TestCase classes are turned into pytest fixtures
  • use pytest-mock fixture instead of decorator from unittest.patch
  • use requests_mock_datadir fixture from swh-core simplifying the setup of mocked HTTP requests
  • expose some Django assertions to be used with pytest

Some cleanups have also been performed on the tests implementation, notably:

  • Better formatting of string litterals
  • Overall code style improvements
  • Removal of tests related to origin ids

Closes T2062