def test_update_editolido_json_greater_version(self): from editolido.core import update_editolido, infos_from_giturl remote = "https://github.com/flyingeek/editolido/archive/1.0.0b8.zip" local = 'https://github.com/flyingeek/editolido/archive/1.0.0b7.zip' param = 'https://github.com/flyingeek/editolido/archive/1.0.0b6.zip' self.cfg.return_value = infos_from_giturl(local) self.json.return_value = dict(url=remote) update_editolido(param) self.download_package.assert_not_called() self.logger.error.assert_not_called()
def test_update_editolido_json_greater_version(self): from editolido.core import update_editolido, infos_from_giturl remote = "https://github.com/flyingeek/editolido/archive/1.0.0b8.zip" local = 'https://github.com/flyingeek/editolido/archive/1.0.0b7.zip' param = 'https://github.com/flyingeek/editolido/archive/1.0.0b6.zip' self.cfg.return_value = infos_from_giturl(local) self.json.return_value = dict(url=remote) update_editolido(param) self.download_package.assert_not_called() self.logger.error.assert_not_called()
def test_update_editolido_empty_url_needs_update(self): from editolido.core import update_editolido, infos_from_giturl local = 'https://github.com/flyingeek/editolido/archive/1.0.0b7.zip' remote = 'https://github.com/flyingeek/editolido/archive/1.0.0b8.zip' param = '' self.json.return_value = dict(url=remote) self.cfg.return_value = infos_from_giturl(local) update_editolido(param) self.assertTrue(self.download_package.called) self.logger.error.assert_not_called()
def test_update_editolido_empty_url_needs_update(self): from editolido.core import update_editolido, infos_from_giturl local = 'https://github.com/flyingeek/editolido/archive/1.0.0b7.zip' remote = 'https://github.com/flyingeek/editolido/archive/1.0.0b8.zip' param = '' self.json.return_value = dict(url=remote) self.cfg.return_value = infos_from_giturl(local) update_editolido(param) self.assertTrue(self.download_package.called) self.logger.error.assert_not_called()
def test_update_editolido_bad_url(self): from editolido.core import update_editolido, infos_from_giturl local = 'https://github.com/flyingeek/editolido/archive/1.0.0b7.zip' remote = 'https://github.com/flyingeek/editolido/archive/1.0.0b8.zip' param = 'http://www.example.com' self.json.return_value = dict(url=remote) self.cfg.return_value = infos_from_giturl(local) update_editolido(param) self.download_package.assert_not_called() self.logger.error.assert_called_with( 'invalid url http://www.example.com')
def test_update_editolido_bad_url(self): from editolido.core import update_editolido, infos_from_giturl local = 'https://github.com/flyingeek/editolido/archive/1.0.0b7.zip' remote = 'https://github.com/flyingeek/editolido/archive/1.0.0b8.zip' param = 'http://www.example.com' self.json.return_value = dict(url=remote) self.cfg.return_value = infos_from_giturl(local) update_editolido(param) self.download_package.assert_not_called() self.logger.error.assert_called_with( 'invalid url http://www.example.com')
def test_update_editolido_from_branch(self): from editolido.core import update_editolido, infos_from_giturl remote = "https://github.com/flyingeek/editolido/archive/99.99.99.zip" local = 'https://github.com/flyingeek/editolido/archive/master.zip' param = 'https://github.com/flyingeek/editolido/archive/1.0.0b7.zip' self.cfg.return_value = infos_from_giturl(local) self.json.return_value = dict(url=remote) update_editolido(param) self.logger.error.assert_not_called() self.logger.info.assert_any_call('remote version: 1.0.0b7') self.assertTrue(self.download_package.called) self.assertIn(*self.filename(param))
def test_update_editolido_empty_url_needs_update(self): from editolido.core import update_editolido, infos_from_giturl from editolido.bootstrap_editorial import VERSION local = ('https://github.com/flyingeek/editolido/archive/%s.zip' % VERSION) remote = 'https://github.com/flyingeek/editolido/archive/99.99.99.zip' param = '' self.json.return_value = dict(url=remote) self.cfg.return_value = infos_from_giturl(local) update_editolido(param) self.download_package.assert_not_called() self.logger.error.assert_not_called()
def test_update_editolido_from_branch(self): from editolido.core import update_editolido, infos_from_giturl remote = "https://github.com/flyingeek/editolido/archive/99.99.99.zip" local = 'https://github.com/flyingeek/editolido/archive/master.zip' param = 'https://github.com/flyingeek/editolido/archive/1.0.0b7.zip' self.cfg.return_value = infos_from_giturl(local) self.json.return_value = dict(url=remote) update_editolido(param) self.logger.error.assert_not_called() self.logger.info.assert_any_call('remote version: 1.0.0b7') self.assertTrue(self.download_package.called) self.assertIn(*self.filename(param))
def test_update_editolido_empty_url_needs_update(self): from editolido.core import update_editolido, infos_from_giturl from editolido.bootstrap_editorial import VERSION local = ('https://github.com/flyingeek/editolido/archive/%s.zip' % VERSION) remote = 'https://github.com/flyingeek/editolido/archive/99.99.99.zip' param = '' self.json.return_value = dict(url=remote) self.cfg.return_value = infos_from_giturl(local) update_editolido(param) self.download_package.assert_not_called() self.logger.error.assert_not_called()
def test_update_editolido_same_version(self): from editolido.core import update_editolido, infos_from_giturl from editolido.bootstrap_editorial import VERSION local = 'https://github.com/flyingeek/editolido/archive/1.0.0b7.zip' remote = 'https://github.com/flyingeek/editolido/archive/1.0.0b7.zip' param = 'https://github.com/flyingeek/editolido/archive/1.0.0b6.zip' self.json.return_value = dict(url=remote) self.cfg.return_value = infos_from_giturl(local) update_editolido(param) self.logger.info.assert_any_call('remote version: 1.0.0b7') # consider up to date if same version self.logger.info.assert_any_call('local version is %s' % VERSION) self.download_package.assert_not_called() self.logger.error.assert_not_called()
def test_update_editolido_same_version(self): from editolido.core import update_editolido, infos_from_giturl from editolido.bootstrap_editorial import VERSION local = 'https://github.com/flyingeek/editolido/archive/1.0.0b7.zip' remote = 'https://github.com/flyingeek/editolido/archive/1.0.0b7.zip' param = 'https://github.com/flyingeek/editolido/archive/1.0.0b6.zip' self.json.return_value = dict(url=remote) self.cfg.return_value = infos_from_giturl(local) update_editolido(param) self.logger.info.assert_any_call('remote version: 1.0.0b7') # consider up to date if same version self.logger.info.assert_any_call('local version is %s' % VERSION) self.download_package.assert_not_called() self.logger.error.assert_not_called()
def test_update_editolido_bad_json(self): from editolido.core import update_editolido, infos_from_giturl from editolido.bootstrap_editorial import VERSION local = 'https://github.com/flyingeek/editolido/archive/1.0.0b7.zip' remote = 'https://github.com/flyingeek/editolido/archive/invalid.zip' param = 'https://github.com/flyingeek/editolido/archive/1.0.0b6.zip' call = mock.call self.json.return_value = dict(url=remote) self.cfg.return_value = infos_from_giturl(local) update_editolido(param) self.assertIn('json rejected', repr(self.logger.error.call_args)) expected = [ call('remote version: 1.0.0b6'), call('remote zipball url: https://github.com/flyingeek' '/editolido/archive/1.0.0b6.zip'), call(u'local version is %s' % VERSION)] self.assertEqual(self.logger.info.mock_calls, expected) self.download_package.assert_not_called()
def test_update_editolido_bad_json(self): from editolido.core import update_editolido, infos_from_giturl from editolido.bootstrap_editorial import VERSION local = 'https://github.com/flyingeek/editolido/archive/1.0.0b7.zip' remote = 'https://github.com/flyingeek/editolido/archive/invalid.zip' param = 'https://github.com/flyingeek/editolido/archive/1.0.0b6.zip' call = mock.call self.json.return_value = dict(url=remote) self.cfg.return_value = infos_from_giturl(local) update_editolido(param) self.assertIn('json rejected', repr(self.logger.error.call_args)) expected = [ call('remote version: 1.0.0b6'), call('remote zipball url: https://github.com/flyingeek' '/editolido/archive/1.0.0b6.zip'), call(u'local version is %s' % VERSION) ] self.assertEqual(self.logger.info.mock_calls, expected) self.download_package.assert_not_called()
def test_update_editolido_same_branch(self): from editolido.core import update_editolido, infos_from_giturl remote = "https://github.com/flyingeek/editolido/archive/99.99.99.zip" local = 'https://github.com/flyingeek/editolido/archive/master.zip' param = 'https://github.com/flyingeek/editolido/archive/master.zip' self.cfg.return_value = infos_from_giturl(local) self.json.return_value = dict(url=remote) update_editolido(param) self.assertFalse(self.download_package.called) self.logger.error.assert_not_called() call = mock.call from editolido.bootstrap_editorial import VERSION expected = [ call(u'auto update is disabled'), call('remote version: master'), call('remote zipball url: https://github.com/flyingeek' '/editolido/archive/master.zip'), call(u'local code version is %s' % VERSION), call(u'local branch is [master]'), ] self.assertEqual(self.logger.info.mock_calls, expected)
def test_update_editolido_same_branch(self): from editolido.core import update_editolido, infos_from_giturl remote = "https://github.com/flyingeek/editolido/archive/99.99.99.zip" local = 'https://github.com/flyingeek/editolido/archive/master.zip' param = 'https://github.com/flyingeek/editolido/archive/master.zip' self.cfg.return_value = infos_from_giturl(local) self.json.return_value = dict(url=remote) update_editolido(param) self.assertFalse(self.download_package.called) self.logger.error.assert_not_called() call = mock.call from editolido.bootstrap_editorial import VERSION expected = [ call(u'auto update is disabled'), call('remote version: master'), call('remote zipball url: https://github.com/flyingeek' '/editolido/archive/master.zip'), call(u'local code version is %s' % VERSION), call(u'local branch is [master]'), ] self.assertEqual(self.logger.info.mock_calls, expected)