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_revision(): '''Test the vcs_revision method of version.py.''' vcsdir = _vcs_path() if vcsdir is not None: revision_args = ['git', 'rev-list', '--count', 'HEAD'] revision_count = subprocess.check_output( revision_args, cwd=vcsdir, stdin=subprocess.DEVNULL).decode('utf-8').strip() print(revision_count) assert (int(revision_count) == vcs_revision())
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())