'Test simple JSON export of a resource'

def testResourceJSON(self):

    s3db = current.s3db
    assertEqual = self.assertEqual
    assertTrue = self.assertTrue
    assertIn = self.assertIn
    resource = s3db.resource('org_organisation', uid='DATESTORG')
    jstr = resource.json(['name', 'office.name'])
    data = json.loads(jstr)
    assertTrue(isinstance(data, list))
    assertEqual(len(data), 1)
    record = data[0]
    assertIn('org_organisation.name', record)
    assertIn('org_office.name', record)
    assertTrue(isinstance(record['org_office.name'], list))
    assertEqual(len(record['org_office.name']), 2)
    assertIn('DATestOffice1', record['org_office.name'])
    assertIn('DATestOffice2', record['org_office.name'])
    assertEqual(record['org_organisation.name'], 'DATestOrg')
