def test_snapshot_detail_view(self): snapshot, conn = self.make_snapshot() request = self.create_request(matchdict=dict(id=snapshot.id)) view = SnapshotView(request, ec2_conn=conn).snapshot_view() view_snapshot = view.get('snapshot') self.assertEqual(view_snapshot.id, snapshot.id) self.assertEqual(view.get('snapshot_name'), snapshot.id) self.assertEqual(view.get('snapshot_description'), u'test snapshot description') self.assertEqual(view.get('exists_volume'), True)
def test_snapshot_update_view(self): """Snapshot update should contain the snapshot form""" request = testing.DummyRequest(post=True) view = SnapshotView(request).snapshot_update() self.assertTrue(view.get('snapshot_form') is not None)
def test_missing_snapshot_none(self): """Snapshot view should return 404 for missing snapshot""" request = testing.DummyRequest() snapshot = SnapshotView(request).get_snapshot() self.assertTrue(snapshot is None)
def test_missing_snapshot_view(self): """Snapshot view should return 404 for missing snapshot""" request = testing.DummyRequest() view = SnapshotView(request).snapshot_view self.assertRaises(HTTPNotFound, view)
def test_is_tagged_view(self): """Snapshot view should inherit from TaggedItemView""" request = testing.DummyRequest() view = SnapshotView(request) self.assertTrue(isinstance(view, TaggedItemView))