def test_get_version_info(): vcsdir = _vcs_path() versionthing = {'version': product_version()} if vcsdir is not None: versionthing['vcs_version'] = vcs_version() versionthing['updated'] = vcs_timestamp() versionthing['revision'] = vcs_revision() assert (versionthing == get_version_info())
def test_vcs_version(): '''Test the vcs_version method of version.py.''' vcsdir = _vcs_path() if vcsdir is not None: args = ['git', 'rev-parse', '--short', 'HEAD'] revision_hash = subprocess.check_output( args, cwd=vcsdir, stdin=subprocess.DEVNULL).decode('utf-8').strip() assert (revision_hash == vcs_version())
def test_api_endpoint(active_user): '''Test version API endpoint.''' # see test_dataset.py, test_dataset_download_url client = APIClient() client.force_authenticate(user=active_user) url = '/api/version/{}' response = client.get(url) assert (response.data['version'] == __version__) if have_vcs(): assert (response.data['vcs_version'] == vcs_version()) assert (response.data['updated'] == vcs_timestamp()) assert (response.data['revision'] == vcs_revision())