def test_install_update(httpserver, info): """Update is installed""" # Clear any cached data wf = Workflow() wf.reset() # Assert cache was cleared assert wf.cached_data('__workflow_update_status') is None with fakeresponse(httpserver, DATA_JSON, HTTP_HEADERS_JSON): # No update for latest release assert update.install_update(TEST_REPO_SLUG, RELEASE_LATEST) is False # Check for updates assert update.check_update(TEST_REPO_SLUG, RELEASE_CURRENT) is True # Verify new workflow is downloaded and installed c = WorkflowMock() with c: assert update.install_update(TEST_REPO_SLUG, RELEASE_CURRENT) is True assert c.cmd[0] == 'open' assert c.cmd[1].endswith('.alfredworkflow') assert wf.cached_data( '__workflow_update_status')['available'] is False
def test_install_update(self): """Update: installs update""" # Make sure there's no cached update data wf = Workflow() wf.reset() # Verify that there's no update available self.assertIsNone(wf.cached_data('__workflow_update_status')) self.assertFalse(update.install_update(TEST_REPO_SLUG, RELEASE_LATEST)) # Get new update data self.assertTrue(update.check_update(TEST_REPO_SLUG, RELEASE_CURRENT)) # Verify new workflow is downloaded and installed c = WorkflowMock() with c: self.assertTrue(update.install_update(TEST_REPO_SLUG, RELEASE_CURRENT)) self.assertEquals(c.cmd[0], 'open') self.assertTrue(c.cmd[1].endswith('.alfredworkflow')) self.assertFalse(wf.cached_data( '__workflow_update_status')['available'])
def test_install_update(httpserver, info): """Update is installed""" # Clear any cached data wf = Workflow() wf.reset() # Assert cache was cleared assert wf.cached_data('__workflow_update_status') is None with fakeresponse(httpserver, DATA_JSON, HTTP_HEADERS_JSON): # No update for latest release assert update.install_update(TEST_REPO_SLUG, RELEASE_LATEST) is False # Check for updates assert update.check_update(TEST_REPO_SLUG, RELEASE_CURRENT) is True # Verify new workflow is downloaded and installed c = WorkflowMock() with c: assert update.install_update(TEST_REPO_SLUG, RELEASE_CURRENT) is True assert c.cmd[0] == 'open' assert c.cmd[1].endswith('.alfredworkflow') assert wf.cached_data('__workflow_update_status')['available'] is False
def test_install_update(self): """Update: installs update""" # Make sure there's no cached update data wf = Workflow() wf.reset() # Verify that there's no update available self.assertIsNone(wf.cached_data('__workflow_update_status')) self.assertFalse(update.install_update(TEST_REPO_SLUG, RELEASE_LATEST)) # Get new update data self.assertTrue(update.check_update(TEST_REPO_SLUG, RELEASE_CURRENT)) # Verify new workflow is downloaded and installed c = WorkflowMock() with c: self.assertTrue( update.install_update(TEST_REPO_SLUG, RELEASE_CURRENT)) self.assertEquals(c.cmd[0], 'open') self.assertTrue(c.cmd[1].endswith('.alfredworkflow')) self.assertFalse( wf.cached_data('__workflow_update_status')['available'])
def test_install_update(httpserver, infopl, alfred4): """Update is installed.""" key = "__workflow_latest_version" # Clear any cached data wf = Workflow() wf.reset() # Assert cache was cleared assert wf.cached_data(key) is None with fakeresponse(httpserver, RELEASES_JSON, HTTP_HEADERS_JSON): # No update because no update status has been cached assert update.install_update() is False # Check for updates v = update.check_update(TEST_REPO, RELEASE_CURRENT) assert v is True # Verify new workflow is downloaded and installed with WorkflowMock() as c: assert update.install_update() is True assert c.cmd[0] == "open" assert re.search(r"\.alfred(\d+)?workflow$", c.cmd[1]) assert wf.cached_data(key)["available"] is False # Test mangled update data status = wf.cached_data(key) assert status["available"] is False assert status["download"] is None assert status["version"] is None # Flip available bit, but leave rest invalid status["available"] = True wf.cache_data(key, status) with WorkflowMock(): assert update.install_update() is False
def test_install_update(httpserver, infopl, alfred4): """Update is installed.""" key = '__workflow_latest_version' # Clear any cached data wf = Workflow() wf.reset() # Assert cache was cleared assert wf.cached_data(key) is None with fakeresponse(httpserver, RELEASES_JSON, HTTP_HEADERS_JSON): # No update because no update status has been cached assert update.install_update() is False # Check for updates v = update.check_update(TEST_REPO, RELEASE_CURRENT) assert v is True # Verify new workflow is downloaded and installed with WorkflowMock() as c: assert update.install_update() is True assert c.cmd[0] == 'open' assert re.search(r'\.alfred(\d+)?workflow$', c.cmd[1]) assert wf.cached_data(key)['available'] is False # Test mangled update data status = wf.cached_data(key) assert status['available'] is False assert status['download'] is None assert status['version'] is None # Flip available bit, but leave rest invalid status['available'] = True wf.cache_data(key, status) with WorkflowMock(): assert update.install_update() is False