
from learning_journal.models import Entry, DBSession


def test_create_entry(dbtransaction):
    """Assert entry was entered into database."""
    new_entry = Entry(title="Entry1", text="Hey, this works. Awesome.")
    assert new_entry.id is None
    DBSession.flush
    assert new_entry.id is not None


from learning_journal.models import Entry, DBSession


def test_create_entry(dbtransaction):
    """Assert entry was entered into database."""
    new_entry = Entry(title="Entry1", text="Hey, this works. Awesome.")
    assert new_entry.id is None
    DBSession.add(new_entry)
    DBSession.flush
    assert new_entry.id is not None

Modify test file, still doesn't work. Messed around in pshell.
Modify test file, still doesn't work. Messed around in pshell.

  
  from learning_journal.models import Entry, DBSession
  
  
  def test_create_entry(dbtransaction):
      """Assert entry was entered into database."""
      new_entry = Entry(title="Entry1", text="Hey, this works. Awesome.")
      assert new_entry.id is None
+     DBSession.add(new_entry)
      DBSession.flush
      assert new_entry.id is not None
  
Modify test file, still doesn't work. Messed around in pshell.
## Code Before:

from learning_journal.models import Entry, DBSession


def test_create_entry(dbtransaction):
    """Assert entry was entered into database."""
    new_entry = Entry(title="Entry1", text="Hey, this works. Awesome.")
    assert new_entry.id is None
    DBSession.flush
    assert new_entry.id is not None

## Instruction:
Modify test file, still doesn't work. Messed around in pshell.
## Code After:

from learning_journal.models import Entry, DBSession


def test_create_entry(dbtransaction):
    """Assert entry was entered into database."""
    new_entry = Entry(title="Entry1", text="Hey, this works. Awesome.")
    assert new_entry.id is None
    DBSession.add(new_entry)
    DBSession.flush
    assert new_entry.id is not None
