Example #1
0
    def test_find_by_study_and_key(session):
        # type: (Session) -> None

        study = StudyModel(study_id=1, study_name='test-study')
        session.add(
            StudySystemAttributeModel(study_id=study.study_id, key='sample-key', value_json='1'))
        session.commit()

        attr = StudySystemAttributeModel.find_by_study_and_key(study, 'sample-key', session)
        assert attr is not None and '1' == attr.value_json

        assert StudySystemAttributeModel.find_by_study_and_key(study, 'not-found', session) is None
Example #2
0
    def test_find_by_study_and_key(session):
        # type: (Session) -> None

        study = StudyModel(study_id=1, study_name="test-study")
        session.add(
            StudySystemAttributeModel(study_id=study.study_id,
                                      key="sample-key",
                                      value_json="1"))
        session.commit()

        attr = StudySystemAttributeModel.find_by_study_and_key(
            study, "sample-key", session)
        assert attr is not None and "1" == attr.value_json

        assert StudySystemAttributeModel.find_by_study_and_key(
            study, "not-found", session) is None