예제 #1
0
def test_some_data_returns_last_zero_before_data(sandbox):
    with sandbox.db() as db:
        insert(db, '1' * 40, 1111, 0)
        insert(db, '2' * 40, 2222, 0)
        insert(db, '3' * 40, 3333, 1)
        insert_metric_changes(db, '3' * 40, 1)
        assert get_first_data_timestamp('PythonImportCount', db=db) == 2222
예제 #2
0
def test_first_commit_introduces_data(sandbox):
    with sandbox.db() as db:
        insert(db, '1' * 40, 1111, 1)
        insert_metric_changes(db, '1' * 40, 1)
        insert(db, '2' * 40, 2222, 2)
        insert_metric_changes(db, '2' * 40, 1)
        assert get_first_data_timestamp('PythonImportCount', db=db) == 1111
예제 #3
0
def test_first_commit_introduces_data(sandbox):
    with sandbox.db() as db:
        insert(db, '1' * 40, 1111, 1)
        insert_metric_changes(db, '1' * 40, 1)
        insert(db, '2' * 40, 2222, 2)
        insert_metric_changes(db, '2' * 40, 1)
        assert get_first_data_timestamp('PythonImportCount', db=db) == 1111
예제 #4
0
def test_some_data_returns_last_zero_before_data(sandbox):
    with sandbox.db() as db:
        insert(db, '1' * 40, 1111, 0)
        insert(db, '2' * 40, 2222, 0)
        insert(db, '3' * 40, 3333, 1)
        insert_metric_changes(db, '3' * 40, 1)
        assert get_first_data_timestamp('PythonImportCount', db=db) == 2222
예제 #5
0
def all_data(metric_name):
    earliest_timestamp = logic.get_first_data_timestamp(metric_name)
    now = datetime.datetime.today()

    return flask.redirect(flask.url_for(
        'graph.show',
        metric_name=metric_name,
        start=str(earliest_timestamp),
        end=str(to_timestamp(now)),
    ))
예제 #6
0
def all_data(metric_name):
    earliest_timestamp = logic.get_first_data_timestamp(metric_name)
    now = datetime.datetime.today()

    return flask.redirect(flask.url_for(
        'graph.show',
        metric_name=metric_name,
        start=str(earliest_timestamp),
        end=str(to_timestamp(now)),
    ))
예제 #7
0
def test_some_data_returns_first_timestamp(sandbox):
    with sandbox.db() as db:
        insert(db, '1' * 40, 1111, 0)
        assert get_first_data_timestamp('PythonImportCount', db=db) == 0
예제 #8
0
def test_no_data_returns_zero(sandbox):
    with sandbox.db() as db:
        assert get_first_data_timestamp('PythonImportCount', db=db) == 0
예제 #9
0
def test_some_data_returns_first_timestamp(sandbox):
    with sandbox.db() as db:
        insert(db, '1' * 40, 1111, 0)
        assert get_first_data_timestamp('PythonImportCount', db=db) == 0
예제 #10
0
def test_no_data_returns_zero(sandbox):
    with sandbox.db() as db:
        assert get_first_data_timestamp('PythonImportCount', db=db) == 0