Coverage for src\zapy\requests\file_loader.py: 100%

1 from pathlib import Path

2 from dataclasses import dataclass

3

4

5@dataclass

6 class ZapyFileInfo:

7 """Class for keeping track of an item in inventory."""

8 file_location: Path

9 mime_type: str

10 file_name: str

11

12

13 def load_file(relative_path: str, mime_type, context_path=None):

14 base_path_str = context_path or '.'

15 file_location = Path(base_path_str) / relative_path

16 name = file_location.name

17

18 return ZapyFileInfo(file_location, mime_type, name)