Beispiel #1
0
def test_save_not_successful(test_image, tmp_folder):
    # ARRANGE
    s = Steganography(test_image)

    mock_png_path = os.path.join(tmp_folder, "save_not_sucessful.png")
    s._path_as_png = MagicMock()

    # ACT
    s.save(mock_png_path)

    # ASSERT
    assert not os.path.exists(mock_png_path)
    s._path_as_png.assert_not_called()
Beispiel #2
0
def test_save_successful(test_image, tmp_folder):
    # ARRANGE
    s = Steganography(test_image)
    s.encode("doesnt matter")

    mock_png_path = os.path.join(tmp_folder, "save_sucess.png")
    s._path_as_png = MagicMock(return_value=mock_png_path)

    # ACT
    s.save(mock_png_path)

    # ASSERT
    assert os.path.exists(mock_png_path)