def test_embedded(self):
        view = DataView(user=self.user, name='My View',
                        description='This is not a descriptive description')
        view.save()

        # Retrieve the revisions the normal way and make sure the object
        # itself is not included.
        response = self.client.get('/api/views/revisions/',
                                   HTTP_ACCEPT='application/json')
        self.assertEqual(response.status_code, codes.ok)
        self.assertEqual(len(json.loads(response.content)), 1)
        no_embed_revision = json.loads(response.content)[0]
        self.assertFalse('object' in no_embed_revision)

        # Now retrieve the revisiosn with the embed flag enabled and verify
        # that the object is now included with the revision.
        response = self.client.get('/api/views/revisions/', {'embed': True},
                                   HTTP_ACCEPT='application/json')
        self.assertEqual(response.status_code, codes.ok)
        self.assertEqual(len(json.loads(response.content)), 1)
        embed_revision = json.loads(response.content)[0]
        self.assertTrue('object' in embed_revision)

        # Make sure the included object matches the copy of the object directly
        # from the object resource itself.
        response = self.client.get('/api/views/{0}/'.format(view.pk),
                                   HTTP_ACCEPT='application/json')
        self.assertEqual(response.status_code, codes.ok)
        revision_view = json.loads(response.content)

        self.assertEqual(revision_view, embed_revision['object'])
dataset/ETHPy150Open chop-dbhi/serrano/tests/cases/resources/tests/view.py/ViewsRevisionsResourceTestCase.test_embedded/original