Esempio n. 1
0
 def test_snapshots_json_view(self):
     request = self.create_request()
     request.path = '/snapshots/json'
     request.params['csrf_token'] = request.session.get_csrf_token()
     snapshot, conn = self.make_snapshot()
     snapshot.add_tag('Name', 'snapshot_one')
     view = SnapshotsJsonView(request, conn=conn, enable_filters=False).snapshots_json()
     results = view.get('results')
     self.assertEqual(len(results), 1)
     snapshot = results[0]
     self.assertEqual(snapshot.get('name'), u'{0} ({1})'.format('snapshot_one', snapshot.get('id')))
     self.assertEqual(snapshot.get('description'), u'test snapshot description')
     self.assertEqual(snapshot.get('exists_volume'), True)
     self.assertEqual(snapshot.get('volume_size'), 1)
 def test_snapshots_landing_page_json(self):
     request = testing.DummyRequest()
     view = SnapshotsJsonView(request).snapshots_json()
     self.assertEqual(view.get('results'), [])
Esempio n. 3
0
 def test_snapshots_landing_page_json(self):
     request = testing.DummyRequest(post=True)
     view = SnapshotsJsonView(request).snapshots_json()
     self.assertEqual(view.__class__, JSONResponse)
Esempio n. 4
0
 def test_snapshots_landing_page_json(self):
     request = testing.DummyRequest()
     view = SnapshotsJsonView(request).snapshots_json()
     self.assertEqual(view.get('results'), [])