def test_it_cannot_remove_a_git_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') with pytest.raises(ModuleNotFoundException): puppetfile.remove_git_module('apache')
def test_it_remove_a_git_module_from_the_puppetfile(): github_repository = MagicMock() content = github_repository.get_file_contents() content.decoded_content.decode.return_value = ('') puppetfile = Puppetfile(github_repository, 'env', sha='shasha', git_modules=[GIT_MODULE_APACHE]) assert GIT_MODULE_APACHE in puppetfile.git_modules puppetfile.remove_git_module('apache') assert puppetfile.git_modules == [] github_repository.update_file.assert_called_once_with( "Puppetfile", "Puppetfile - Remove git module apache", "", "shasha")