def test_objective_with_valid_fields(): entry = Entry() entry.how = 'this is how' entry.what = 'this is what' entry.save() log_entry = LogEntry() log_entry.entry_type = 'objective' log_entry.entry = entry log_entry.save()
def test_objective_with_invalid_fields(): entry = Entry() entry.how = 'this is how' entry.what = 'this is what' entry.something_not_right = 'this is not right' with pytest.raises(ValidationError): log_entry = LogEntry() log_entry.entry_type = 'objective' log_entry.entry = entry log_entry.save()
def test_save_log_entry_with_objective(): entry = Entry() entry.how = 'this is how' entry.what = 'this is what' entry.save() log_entry = LogEntry() log_entry.entry_type = 'objective' log_entry.entry = entry log_entry.save() from_db = LogEntry.objects(id=log_entry.id).get() assert from_db.entry_type == 'objective' assert from_db.entry.how == 'this is how' assert from_db.entry.what == 'this is what'