Ejemplo n.º 1
0
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()
Ejemplo n.º 2
0
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()
Ejemplo n.º 3
0
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'
Ejemplo n.º 4
0
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'