def test_volume_detail_view_with_existing_volume(self): volume = self.make_volume() request = self.create_request(matchdict=dict(id=volume.id)) self.setup_session(request) view = VolumeView(request).volume_view() self.assertEqual(view.get('volume').id, volume.id) self.assertEqual(view.get('volume_name'), volume.id)
def test_volume_detail_view_with_new_volume(self): volume, conn = self.make_volume() request = self.create_request(matchdict=dict(id='new')) view = VolumeView(request, ec2_conn=conn).volume_view() self.assertEqual(view.get('volume'), None)
def test_volume_detail_view_with_existing_volume(self): volume, conn = self.make_volume() request = self.create_request(matchdict=dict(id=volume.id)) view = VolumeView(request, ec2_conn=conn).volume_view() self.assertEqual(view.get('volume').id, volume.id) self.assertEqual(view.get('volume_name'), volume.id)
def test_volume_update_view(self): """Volume update should contain the volume form""" request = testing.DummyRequest(post=True) request.POST = {} view = VolumeView(request).volume_update() self.assertTrue(view.get('volume_form') is not None)
def test_volume_update_view(self): """Volume update should contain the volume form""" request = testing.DummyRequest(post=True) view = VolumeView(request).volume_update() self.assertTrue(view.get('volume_form') is not None)
def test_missing_volume_view(self): """Volume view should return 404 for missing volume""" request = testing.DummyRequest() view = VolumeView(request).volume_view self.assertRaises(HTTPNotFound, view)
def test_is_tagged_view(self): """Volume view should inherit from TaggedItemView""" request = testing.DummyRequest() view = VolumeView(request) self.assertTrue(isinstance(view, TaggedItemView))