コード例 #1
0
def test_list_view_contains_new_data_added(dummy_request, new_entry):
    """Test if data sent through the request is added to the db."""
    from learning_journal.views.default import list_view
    dummy_request.dbsession.add(new_entry)
    dummy_request.dbsession.commit()
    response = list_view(dummy_request)
    assert new_entry.to_dict() in response['entry']
コード例 #2
0
def test_list_view_returns_a_dict(dummy_request):
    """Test if list view returns dictionary."""
    from learning_journal.views.default import list_view
    response = list_view(dummy_request)
    assert isinstance(response, dict)
コード例 #3
0
def test_list_view_returns_count_matching_database(dummy_request, add_models):
    """List view response matches database count."""
    from learning_journal.views.default import list_view
    response = list_view(dummy_request)
    query = dummy_request.dbsession.query(JournalEntry)
    assert len(response['entry']) == query.count()
コード例 #4
0
def list_response():
    """Return a response from the list view."""
    from learning_journal.views.default import list_view
    request = testing.DummyRequest()
    response = list_view(request)
    return response
コード例 #5
0
def test_list_view_returns_empty_when_database_empty(dummy_request):
    """List view returns nothing when there is no data."""
    from learning_journal.views.default import list_view
    response = list_view(dummy_request)
    assert len(response['entry']) == 0