Loading test/integration/test_repository_operations.py +8 −7 Original line number Diff line number Diff line Loading @@ -60,11 +60,12 @@ class TestRepositoryInstallIntegrationTestCase(integration_util.IntegrationTestC def test_repository_update(self): response = self._install_repository(revision=REVISION_4, version="0.0.3")[0] assert int(response['ctx_rev']) >= 4 latest_revision = response['changeset_revision'] repo_response = self._get("/api/tool_shed_repositories/%s" % response['id']).json() assert repo_response['tool_shed_status']['revision_update'] == 'False' # that should really be a boolean # now checkout revision 3 and attempt an update path_components = [ self._app.config.shed_tools_dir, os.path.dirname(self._app.config.shed_tool_config_file), 'toolshed.g2.bx.psu.edu', 'repos', REPO.owner, Loading @@ -73,25 +74,25 @@ class TestRepositoryInstallIntegrationTestCase(integration_util.IntegrationTestC REPO.name ] revision_3_path = os.path.join(*path_components[:6]) revision_4_path = os.path.join(*path_components[:5] + [REVISION_4]) latest_revision_path = os.path.join(*path_components[:5] + [latest_revision]) repository_path = os.path.join(*path_components) # Move repo to location expected before minor update os.rename(revision_4_path, revision_3_path) os.rename(latest_revision_path, revision_3_path) # Checkout revision 3 hg_util.update_repository(repository_path, ctx_rev='3') # change repo to revision 3 in database model = self._app.install_model tsr = model.context.query(model.ToolShedRepository).first() assert tsr.name == REPO.name assert tsr.changeset_revision == REVISION_4 assert tsr.ctx_rev == '4' assert tsr.changeset_revision == latest_revision assert int(tsr.ctx_rev) >= 4 tsr.ctx_rev = '3' tsr.installed_changeset_revision = REVISION_3 tsr.changeset_revision = REVISION_3 model.context.flush() # update shed_tool_conf.xml to look like revision 3 was the installed_changeset_revision with open(self._app.config.shed_tool_config_file) as shed_config: shed_text = shed_config.read().replace(REVISION_4, REVISION_3) shed_text = shed_config.read().replace(latest_revision, REVISION_3) with open(self._app.config.shed_tool_config_file, 'w') as shed_config: shed_config.write(shed_text) self._get( Loading @@ -106,7 +107,7 @@ class TestRepositoryInstallIntegrationTestCase(integration_util.IntegrationTestC assert repo_response['ctx_rev'] == '3' # now install revision 4 (a.k.a a minor update) response = self._install_repository(revision=REVISION_4, version="0.0.3", verify_tool_absent=False)[0] assert response['changeset_revision'] == REVISION_4 assert response['changeset_revision'] == latest_revision assert response['installed_changeset_revision'] == REVISION_3 # should be 4 or newer assert int(response['ctx_rev']) >= 4 Loading Loading
test/integration/test_repository_operations.py +8 −7 Original line number Diff line number Diff line Loading @@ -60,11 +60,12 @@ class TestRepositoryInstallIntegrationTestCase(integration_util.IntegrationTestC def test_repository_update(self): response = self._install_repository(revision=REVISION_4, version="0.0.3")[0] assert int(response['ctx_rev']) >= 4 latest_revision = response['changeset_revision'] repo_response = self._get("/api/tool_shed_repositories/%s" % response['id']).json() assert repo_response['tool_shed_status']['revision_update'] == 'False' # that should really be a boolean # now checkout revision 3 and attempt an update path_components = [ self._app.config.shed_tools_dir, os.path.dirname(self._app.config.shed_tool_config_file), 'toolshed.g2.bx.psu.edu', 'repos', REPO.owner, Loading @@ -73,25 +74,25 @@ class TestRepositoryInstallIntegrationTestCase(integration_util.IntegrationTestC REPO.name ] revision_3_path = os.path.join(*path_components[:6]) revision_4_path = os.path.join(*path_components[:5] + [REVISION_4]) latest_revision_path = os.path.join(*path_components[:5] + [latest_revision]) repository_path = os.path.join(*path_components) # Move repo to location expected before minor update os.rename(revision_4_path, revision_3_path) os.rename(latest_revision_path, revision_3_path) # Checkout revision 3 hg_util.update_repository(repository_path, ctx_rev='3') # change repo to revision 3 in database model = self._app.install_model tsr = model.context.query(model.ToolShedRepository).first() assert tsr.name == REPO.name assert tsr.changeset_revision == REVISION_4 assert tsr.ctx_rev == '4' assert tsr.changeset_revision == latest_revision assert int(tsr.ctx_rev) >= 4 tsr.ctx_rev = '3' tsr.installed_changeset_revision = REVISION_3 tsr.changeset_revision = REVISION_3 model.context.flush() # update shed_tool_conf.xml to look like revision 3 was the installed_changeset_revision with open(self._app.config.shed_tool_config_file) as shed_config: shed_text = shed_config.read().replace(REVISION_4, REVISION_3) shed_text = shed_config.read().replace(latest_revision, REVISION_3) with open(self._app.config.shed_tool_config_file, 'w') as shed_config: shed_config.write(shed_text) self._get( Loading @@ -106,7 +107,7 @@ class TestRepositoryInstallIntegrationTestCase(integration_util.IntegrationTestC assert repo_response['ctx_rev'] == '3' # now install revision 4 (a.k.a a minor update) response = self._install_repository(revision=REVISION_4, version="0.0.3", verify_tool_absent=False)[0] assert response['changeset_revision'] == REVISION_4 assert response['changeset_revision'] == latest_revision assert response['installed_changeset_revision'] == REVISION_3 # should be 4 or newer assert int(response['ctx_rev']) >= 4 Loading