1. 22 Mar, 2021 1 commit
  2. 18 Mar, 2021 1 commit
    • David Runge's avatar
      Add methods for reading and streaming JSON files · 3103d0f7
      David Runge authored
      repo_management/files.py:
      Add `_json_files_in_directory()` yield a list of files with a .json
      suffix in a directory.
      Add `_read_pkgbase_json_file()` to read a JSON file representing a
      pkgbase and return an `OutputPackageBase` model.
      Add `_write_db_file()` to open a tar file for writing.
      Add `_stream_package_base_to_db()` to stream a `models.OutputPackage()`
      to a tar file (which represents a .db or a .files repository database).
      
      tests/test_files.py:
      Add tests for `_json_files_in_directory()`, `_read_pkgbase_json_file()`,
      `_write_db_file()` and `_stream_package_base_to_db()`.
      3103d0f7
  3. 08 Mar, 2021 4 commits
    • David Runge's avatar
      Make use of common helper for fixtures · e04209ae
      David Runge authored
      tests/test_files.py:
      Make use of common helper in `tests/fixtures.py` for creating repository
      database fixtures.
      e04209ae
    • David Runge's avatar
      Rename tests for files · 2ec219d6
      David Runge authored
      Rename the tests file used to test files.
      2ec219d6
    • David Runge's avatar
      Change repository member iterator to yield model · dc8d4b80
      David Runge authored
      repo_management/files.py:
      Add the private method `_extract_db_member_package_name()` which can be
      used to extract the package name from the name of a member of repository
      database.
      Rename `_read_db_file_member()` to `_db_file_member_as_model()` and
      change the method to yield a `models.RepoDbMemberData` instead of a
      `tarfile.TarInfo` to provide actual data (and required context) to
      callers of the method.
      
      tests/test_file.py:
      Add parametrized test for `_extract_db_member_package_name()`.
      Change test for `_db_file_member_as_model()` to assert the correct
      return type.
      dc8d4b80
    • David Runge's avatar
      Add iterator for TarFile members · 2660ca6c
      David Runge authored
      repo_management/files.py:
      Add iterator method `_read_db_file_member()` to yield the members of a
      provided tarfile.TarFile.
      The members are filtered by name using a regular expression, which can
      be overridden.
      
      tests/test_file.py:
      Change `create_db_file()` to also create 'desc' and 'files' files below
      the created temporary directories.
      Assert, that all tested methods return a value.
      Add test for `_read_db_file_member()`.
      2660ca6c
  4. 07 Mar, 2021 1 commit
    • David Runge's avatar
      Add method to read db file · 70bdbd76
      David Runge authored
      repo_management/files.py:
      Add `_read_db_file()` to open a db file and return it as
      tarfile.Tarfile. The method assumes gzip-compressed databases by
      default, but can be used with other compression algorithms.
      
      tests/test_file.py:
      Add fixtures and tests for `_read_db_file()`.
      70bdbd76