def test_delete_volume(self): self.stubs.Set(SolidFire, '_issue_api_request', self.fake_issue_api_request) testvol = {'project_id': 'testprjid', 'name': 'test_volume', 'size': 1, 'id': 'a720b3c0-d1f0-11e1-9b23-0800200c9a66'} sfv = SolidFire() model_update = sfv.delete_volume(testvol)
def test_create_volume(self): self.stubs.Set(SolidFire, '_issue_api_request', self.fake_issue_api_request) testvol = {'project_id': 'testprjid', 'name': 'testvol', 'size': 1, 'id': 'a720b3c0-d1f0-11e1-9b23-0800200c9a66'} sfv = SolidFire() model_update = sfv.create_volume(testvol)
def test_delete_volume_fails_no_volume(self): self.stubs.Set(SolidFire, '_issue_api_request', self.fake_issue_api_request) testvol = {'project_id': 'testprjid', 'name': 'no-name', 'size': 1, 'id': 'a720b3c0-d1f0-11e1-9b23-0800200c9a66'} sfv = SolidFire() try: model_update = sfv.delete_volume(testvol) self.fail("Should have thrown Error") except Exception: pass
def test_create_volume_with_qos(self): preset_qos = {} preset_qos['qos'] = 'fast' self.stubs.Set(SolidFire, '_issue_api_request', self.fake_issue_api_request) testvol = {'project_id': 'testprjid', 'name': 'testvol', 'size': 1, 'id': 'a720b3c0-d1f0-11e1-9b23-0800200c9a66', 'metadata': [preset_qos]} sfv = SolidFire() model_update = sfv.create_volume(testvol)
def test_delete_volume_fails_no_volume(self): self.stubs.Set(SolidFire, '_issue_api_request', self.fake_issue_api_request) testvol = { 'project_id': 'testprjid', 'name': 'no-name', 'size': 1, 'id': 'a720b3c0-d1f0-11e1-9b23-0800200c9a66' } sfv = SolidFire() try: model_update = sfv.delete_volume(testvol) self.fail("Should have thrown Error") except Exception: pass
def test_delete_volume_fails_no_volume(self): self.stubs.Set(SolidFire, '_issue_api_request', self.fake_issue_api_request_no_volume) testvol = {'project_id': 'testprjid', 'name': 'no-name', 'size': 1, 'id': 'a720b3c0-d1f0-11e1-9b23-0800200c9a66'} sfv = SolidFire() self.assertRaises(exception.VolumeNotFound, sfv.delete_volume, testvol)
def test_create_volume_fails(self): self.stubs.Set(SolidFire, '_issue_api_request', self.fake_issue_api_request_fails) testvol = {'project_id': 'testprjid', 'name': 'testvol', 'size': 1, 'id': 'a720b3c0-d1f0-11e1-9b23-0800200c9a66'} sfv = SolidFire() self.assertRaises(exception.SolidFireAPIDataException, sfv.create_volume, testvol)
def test_get_cluster_info_fail(self): self.stubs.Set(SolidFire, '_issue_api_request', self.fake_issue_api_request_fails) sfv = SolidFire() self.assertRaises(exception.SolidFireAPIException, sfv._get_cluster_info)
def test_get_cluster_info(self): self.stubs.Set(SolidFire, '_issue_api_request', self.fake_issue_api_request) sfv = SolidFire() sfv._get_cluster_info()
def test_get_sfaccount_by_name_fails(self): sfv = SolidFire() self.stubs.Set(SolidFire, '_issue_api_request', self.fake_issue_api_request_fails) account = sfv._get_sfaccount_by_name('some-name') self.assertEqual(account, None)
def test_create_sfaccount_fails(self): sfv = SolidFire() self.stubs.Set(SolidFire, '_issue_api_request', self.fake_issue_api_request_fails) account = sfv._create_sfaccount('project-id') self.assertEqual(account, None)