Exemplo n.º 1
0
    def test_is_public(self, is_public, expected):
        fake_share_group_type_info = {'name': 'fake_name'}
        if is_public is not None:
            fake_share_group_type_info['is_public'] = is_public
        share_group_type = types.ShareGroupType(self.manager,
                                                fake_share_group_type_info,
                                                loaded=True)

        result = share_group_type.is_public

        self.assertEqual(expected, result)
Exemplo n.º 2
0
    def test_get_keys_force_api_call(self):
        share_group_type = types.ShareGroupType(
            self.manager, self.fake_share_group_type_info, loaded=True)
        share_group_type._group_specs = {}
        self.manager.api.client.get = mock.Mock(
            return_value=(None, self.fake_share_group_type_info))

        result = share_group_type.get_keys(prefer_resource_data=False)

        self.assertEqual(self.fake_group_specs, result)
        self.manager.api.client.get.assert_called_once_with(
            types.GROUP_SPECS_RESOURCES_PATH % fake.ShareGroupType.id)
Exemplo n.º 3
0
 def setUp(self):
     super(ShareGroupTypeTest, self).setUp()
     self.manager = types.ShareGroupTypeManager(fake.FakeClient())
     self.fake_group_specs = {'key1': 'value1', 'key2': 'value2'}
     self.fake_share_group_type_info = {
         'id': fake.ShareGroupType.id,
         'share_types': [fake.ShareType.id],
         'name': fake.ShareGroupType.name,
         'is_public': fake.ShareGroupType.is_public,
         'group_specs': self.fake_group_specs,
     }
     self.share_group_type = types.ShareGroupType(
         self.manager, self.fake_share_group_type_info, loaded=True)
Exemplo n.º 4
0
    share_types.ShareTypeManager(FakeAPIClient), {
        'id': 'share-type-id4',
        'name': 'test-share-type4',
        'share_type_access:is_public': True,
        'extra_specs': {
            'snapshot_support': True,
            'driver_handles_share_servers': False
        }
    })

share_group_type = share_group_types.ShareGroupType(
    share_group_types.ShareGroupTypeManager(FakeAPIClient), {
        'id': 'fake_share_group_type_id1',
        'name': 'fake_share_group_type_name',
        'share_types': [share_type.id],
        'group_specs': {
            'k1': 'v1',
            'k2': 'v2'
        },
        'is_public': True
    })

share_group_type_private = share_group_types.ShareGroupType(
    share_group_types.ShareGroupTypeManager(FakeAPIClient), {
        'id': 'fake_private_share_group_type_id2',
        'name': 'fake_private_share_group_type_name',
        'share_types': [share_type.id, share_type_private.id],
        'group_specs': {
            'k1': 'v1',
            'k2': 'v2'
        },