def test_populates_restricted_word(db):
    model = VirtualWordCondition(rc_words='tdd, quality')
    create_records(model, db.session)
    result = db.session.query(RestrictedWord).all()

    assert_that(len(result), equal_to(2))
    assert_that(result[0].word_phrase, equal_to('tdd'))
    assert_that(result[1].word_phrase, equal_to('quality'))
def test_multi_creation(db):
    one = VirtualWordCondition(rc_consenting_body='needs approval',
                               rc_words='tdd, quality')
    db.session.add(one)
    create_records(one, db.session)

    two = VirtualWordCondition(rc_consenting_body='needs signature',
                               rc_words='bc, royal')
    db.session.add(two)
    create_records(two, db.session)

    three = VirtualWordCondition(rc_consenting_body='needs magic',
                                 rc_words='one, two, three, four ,five')
    db.session.add(three)
    create_records(three, db.session)

    result = db.session.query(RestrictedWordCondition).all()

    assert_that(len(result), equal_to(9))
def test_populates_restricted_word_condition(db):
    model = VirtualWordCondition(rc_consenting_body='needs approval',
                                 rc_words='tdd, quality')
    create_records(model, db.session)
    result = db.session.query(RestrictedWordCondition).all()

    assert_that(len(result), equal_to(2))
    assert_that(result[0].cnd_id, equal_to(1))
    assert_that(result[0].word_id, equal_to(1))
    assert_that(result[1].cnd_id, equal_to(1))
    assert_that(result[1].word_id, equal_to(2))
def test_default_flags(db):
    model = VirtualWordCondition(rc_consenting_body='needs approval',
                                 rc_condition_text='do that',
                                 rc_instructions='call me')
    create_records(model, db.session)
    result = db.session.query(RestrictedCondition).all()

    assert_that(len(result), equal_to(1))
    assert_that(result[0].consenting_body, equal_to('needs approval'))
    assert_that(result[0].cnd_text, equal_to('do that'))
    assert_that(result[0].instructions, equal_to('call me'))
    assert_that(result[0].allow_use, equal_to('Y'))
    assert_that(result[0].consent_required, equal_to('N'))
Ejemplo n.º 5
0
def test_populates_restricted_condition(db):
    initial = VirtualWordCondition(rc_consenting_body='needs approval',
                                   rc_words='tdd, quality')
    db.session.add(initial)
    create_records(initial, db.session)

    result = db.session.query(VirtualWordCondition).all()
    updated = result[0]
    updated.rc_consenting_body = 'needs signature'
    db.session.commit()
    assert_that(result[0].rc_consenting_body, equal_to('needs signature'))

    result = db.session.query(VirtualWordCondition).all()
    assert_that(len(result), equal_to(1))

    update_records(db.session)
    result = db.session.query(RestrictedCondition).all()

    assert_that(len(result), equal_to(1))
    assert_that(result[0].consenting_body, equal_to('needs signature'))
def test_allow_use_defaults_to_true(db):
    record = VirtualWordCondition()
    db.session.add(record)
    db.session.commit()

    assert_that(record.rc_allow_use, equal_to(True))
def test_consent_required_defaults_to_false(db):
    record = VirtualWordCondition()
    db.session.add(record)
    db.session.commit()

    assert_that(record.rc_consent_required, equal_to(False))