'Test that non-standard, custom resource classes hit the database and
return appropriate results, caching the results after a single
query.'

def test_rc_cache_custom(self):

    cache = rc_cache.ResourceClassCache(self.context)
    self.assertRaises(exception.ResourceClassNotFound, cache.string_from_id, 1001)
    self.assertRaises(exception.ResourceClassNotFound, cache.id_from_string, 'IRON_NFV')
    with self.context.session.connection() as conn:
        ins_stmt = rc_cache._RC_TBL.insert().values(id=1001, name='IRON_NFV')
        conn.execute(ins_stmt)
    self.assertEqual('IRON_NFV', cache.string_from_id(1001))
    self.assertEqual(1001, cache.id_from_string('IRON_NFV'))
    with mock.patch('sqlalchemy.select') as sel_mock:
        self.assertEqual('IRON_NFV', cache.string_from_id(1001))
        self.assertEqual(1001, cache.id_from_string('IRON_NFV'))
        self.assertFalse(sel_mock.called)
