def test_identity_to_json():
    org = Organization(
        id=1,
        name='Test Organization',
        subject_id_label='Subject',
        modified=datetime.datetime(2015, 1, 1),
        created=datetime.datetime(2015, 1, 1)
    )
    jsonStr = org.json_from_identity(org)
    assert isinstance(jsonStr, str)
    obj = json.loads(jsonStr)
    assert obj['name'] == org.name
def test_identity_from_json():
    jsonStr = {
        "id": 1,
        "name": "Test Organization",
        "subject_id_label": "Subject",
        'modified': '2012-01-01 01:01:01',
        'created': '2012-01-01 01:01:01',
    }
    _org = Organization(
        id=1,
        name='Test Organization',
        subject_id_label='Subject',
        modified=datetime.datetime(2015, 1, 1),
        created=datetime.datetime(2015, 1, 1)
    )
    org = _org.identity_from_json(json.dumps(jsonStr))
    assert org.name == _org.name
Example #3
0
    PDSSubjectRecordDetailView, PDSRecordLinkDetailView, PDSAvailableLinksView
from api.views.base import BRPApiView

factory = APIRequestFactory()

TestSubject = Subject(id=2,
                      first_name='Jane',
                      last_name='Sample',
                      organization_id=1,
                      organization_subject_id='MRN123',
                      dob=datetime.date(1990, 1, 1),
                      modified=datetime.datetime(2015, 1, 1),
                      created=datetime.datetime(2015, 1, 1))
TestOrganization = Organization(id=1,
                                name='Amazing Children\'s Hospital',
                                subject_id_label='Subject',
                                modified=datetime.datetime(2015, 1, 1),
                                created=datetime.datetime(2015, 1, 1))
TestExternalRecord = ExternalRecord(record_id='xyz123',
                                    external_system_id=1,
                                    subject_id=1,
                                    path='testpath',
                                    modified=datetime.datetime(2014, 1, 1),
                                    created=datetime.datetime(2014, 1, 1),
                                    id=1,
                                    label_id=1)
TestGroup = Group(id=1,
                  name='TestGroup',
                  is_locking=False,
                  client_key='testck',
                  description='A test group')