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
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
Example #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
Example #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
Example #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)),
    ))
Example #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)),
    ))
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
def test_no_data_returns_zero(sandbox):
    with sandbox.db() as db:
        assert get_first_data_timestamp('PythonImportCount', db=db) == 0
Example #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
Example #10
0
def test_no_data_returns_zero(sandbox):
    with sandbox.db() as db:
        assert get_first_data_timestamp('PythonImportCount', db=db) == 0