def get_package_content_should_return_none_when_file_does_not_exist(temp_dir): temp_dir.create_directory("packages") index = PackageIndex("any_name", temp_dir.join("packages")) actual_content = index.get_package_content("eggs", "0.1.2") assert_that(actual_content).is_none()
def get_package_content_should_return_file_content_when_file_exists(temp_dir): content = "spam and eggs" temp_dir.create_directory("packages") temp_dir.create_file(["packages", "eggs-0.1.2.tar.gz"], content, binary=True) index = PackageIndex("any_name", temp_dir.join("packages")) actual_content = index.get_package_content("eggs", "0.1.2") assert_that(actual_content).is_equal_to(content)