def test_it_cannot_remove_a_forge_module_not_present_in_the_puppetfile(): github_repository = MagicMock() content = github_repository.get_file_contents() content.decoded_content.decode.return_value = ('') puppetfile = Puppetfile(github_repository, 'env', sha='shasha') assert puppetfile.forge_modules == [] with pytest.raises(ModuleNotFoundException): puppetfile.remove_forge_module('puppetlabs/apache')
def test_it_remove_a_forge_module_from_the_puppetfile(): github_repository = MagicMock() content = github_repository.get_file_contents() content.decoded_content.decode.return_value = ('') forge_module_apache = ForgeModule('puppetlabs/apache', '0.1.10') puppetfile = Puppetfile(github_repository, 'env', sha='shasha', forge_modules=[forge_module_apache]) assert forge_module_apache in puppetfile.forge_modules puppetfile.remove_forge_module('puppetlabs/apache') assert puppetfile.forge_modules == [] github_repository.update_file.assert_called_once_with( "Puppetfile", "Puppetfile - Remove forge module puppetlabs/apache", "", "shasha")