def test_it_cannot_update_a_missing_module():
     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.update_forge_module('puppetlabs/apache', '0.1.2')
 def test_it_update_a_module_in_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.1')
     puppetfile = Puppetfile(github_repository,
                             'env',
                             sha='shasha',
                             forge_modules=[forge_module_apache])
     assert puppetfile.forge_modules[0].version == '0.1.1'
     puppetfile.update_forge_module('puppetlabs/apache', version='0.1.2')
     assert puppetfile.forge_modules[0].version == '0.1.2'
     github_repository.update_file.assert_called_once_with(
         "Puppetfile",
         ("Puppetfile - Update forge module puppetlabs/apache "
          "from 0.1.1 to 0.1.2"), "mod 'puppetlabs/apache', '0.1.2'\n",
         "shasha")