def test_snapshot_show(self, version):
        req = fakes.HTTPRequest.blank('/snapshots/200', version=version)
        expected = fake_share.expected_snapshot(version=version, id=200)

        res_dict = self.controller.show(req, 200)

        self.assertEqual(expected, res_dict)
Example #2
0
 def test_snapshot_list_detail(self):
     env = {'QUERY_STRING': 'name=Share+Test+Name'}
     req = fakes.HTTPRequest.blank('/shares/detail', environ=env)
     res_dict = self.controller.detail(req)
     expected_s = fake_share.expected_snapshot(id=2)
     expected = {'snapshots': [expected_s['snapshot']]}
     self.assertEqual(expected, res_dict)
 def test_snapshot_list_detail(self):
     env = {'QUERY_STRING': 'name=Share+Test+Name'}
     req = fakes.HTTPRequest.blank('/shares/detail', environ=env)
     res_dict = self.controller.detail(req)
     expected_s = fake_share.expected_snapshot(id=2)
     expected = {'snapshots': [expected_s['snapshot']]}
     self.assertEqual(expected, res_dict)
Example #4
0
    def test_snapshot_show(self, version):
        req = fakes.HTTPRequest.blank('/snapshots/200', version=version)
        expected = fake_share.expected_snapshot(version=version, id=200)

        res_dict = self.controller.show(req, 200)

        self.assertEqual(expected, res_dict)
Example #5
0
    def test_snapshot_create(self, snapshot_support):
        self.mock_object(share_api.API, 'create_snapshot',
                         stubs.stub_snapshot_create)
        body = {
            'snapshot': {
                'share_id': 'fakeshareid',
                'force': False,
                'name': 'displaysnapname',
                'description': 'displaysnapdesc',
            }
        }
        req = fakes.HTTPRequest.blank('/snapshots')

        res_dict = self.controller.create(req, body)

        expected = fake_share.expected_snapshot(id=200)

        self.assertEqual(expected, res_dict)
    def test_snapshot_create(self, snapshot_support):
        self.mock_object(share_api.API, 'create_snapshot',
                         stubs.stub_snapshot_create)
        body = {
            'snapshot': {
                'share_id': 'fakeshareid',
                'force': False,
                'name': 'displaysnapname',
                'description': 'displaysnapdesc',
            }
        }
        req = fakes.HTTPRequest.blank('/snapshots')

        res_dict = self.controller.create(req, body)

        expected = fake_share.expected_snapshot(id=200)

        self.assertEqual(expected, res_dict)
Example #7
0
    def test_snapshot_create(self, version):
        self.mock_object(share_api.API, 'create_snapshot',
                         stubs.stub_snapshot_create)

        body = {
            'snapshot': {
                'share_id': 'fakeshareid',
                'force': False,
                'name': 'displaysnapname',
                'description': 'displaysnapdesc',
            }
        }
        url = ('/v2/fake/snapshots'
               if version.startswith('2.') else '/v1/fake/snapshots')
        req = fakes.HTTPRequest.blank(url, version=version)

        res_dict = self.controller.create(req, body)

        expected = fake_share.expected_snapshot(version=version, id=200)

        self.assertEqual(expected, res_dict)
Example #8
0
 def test_snapshot_show(self):
     req = fakes.HTTPRequest.blank('/fake/snapshots/200')
     res_dict = self.controller.show(req, 200)
     expected = fake_share.expected_snapshot(id=200)
     self.assertEqual(expected, res_dict)