Esempio n. 1
0
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())
Esempio n. 2
0
def test_vcs_timestamp():
    vcsdir = _vcs_path()
    if vcsdir is not None:
        args = ['git', 'log', '-n', '1', "--pretty=format:%ci"]
        time_stamp = subprocess.check_output(
                    args, cwd=vcsdir, stdin=subprocess.DEVNULL).decode('utf-8').strip()
                    
        ts = dateutil.parser.parse(time_stamp)
        assert (ts == vcs_timestamp())
Esempio n. 3
0
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())