def test_get_stages_names(value: str, expected: List[str]) -> None: d = Docker() with tempfile.NamedTemporaryFile() as f: encoded_string = str.encode(value, encoding="UTF-8") f.write(encoded_string) f.seek(0) d.dockerfile = Path(f.name) stage_names = [stage.name for stage in d.get_stages()] assert stage_names == expected
def test_get_stages_from_line(value: str, expected: int) -> None: d = Docker() test_strings = { value: expected, value.lower(): expected, value.upper(): expected } for string, result in test_strings.items(): with tempfile.NamedTemporaryFile() as f: encoded_string = str.encode(string, encoding="UTF-8") f.write(encoded_string) f.seek(0) f.seek(0) d.dockerfile = Path(f.name) assert len(d.get_stages()) == result