~ubuntu-branches/ubuntu/trusty/heat/trusty-security

« back to all changes in this revision

Viewing changes to heat/tests/test_sqlalchemy_api.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-10-03 09:43:04 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20131003094304-k2c4qcsfn7cv6eos
Tags: 2013.2~rc1-0ubuntu1
* New upstream release.
* debian/control: Dropped python-d2to1 build dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
203
203
        st_db = db_api.stack_get_all_by_tenant(self.ctx)
204
204
        self.assertEqual(0, len(st_db))
205
205
 
 
206
    def test_stack_count_all_by_tenant(self):
 
207
        stacks = [self._setup_test_stack('stack', x)[1] for x in UUIDs]
 
208
 
 
209
        st_db = db_api.stack_count_all_by_tenant(self.ctx)
 
210
        self.assertEqual(2, st_db)
 
211
 
 
212
        stacks[0].delete()
 
213
        st_db = db_api.stack_count_all_by_tenant(self.ctx)
 
214
        self.assertEqual(1, st_db)
 
215
 
 
216
        stacks[1].delete()
 
217
        st_db = db_api.stack_count_all_by_tenant(self.ctx)
 
218
        self.assertEqual(0, st_db)
 
219
 
206
220
    def test_event_get_all_by_stack(self):
207
221
        stack = self._setup_test_stack('stack', UUID1)[1]
208
222
 
223
237
 
224
238
        self.m.VerifyAll()
225
239
 
 
240
    def test_event_count_all_by_stack(self):
 
241
        stack = self._setup_test_stack('stack', UUID1)[1]
 
242
 
 
243
        self._mock_create(self.m)
 
244
        self.m.ReplayAll()
 
245
        stack.create()
 
246
        self.m.UnsetStubs()
 
247
 
 
248
        num_events = db_api.event_count_all_by_stack(self.ctx, UUID1)
 
249
        self.assertEqual(2, num_events)
 
250
 
 
251
        self._mock_delete(self.m)
 
252
        self.m.ReplayAll()
 
253
        stack.delete()
 
254
 
 
255
        num_events = db_api.event_count_all_by_stack(self.ctx, UUID1)
 
256
        self.assertEqual(4, num_events)
 
257
 
 
258
        self.m.VerifyAll()
 
259
 
226
260
    def test_event_get_all_by_tenant(self):
227
261
        stacks = [self._setup_test_stack('stack', x)[1] for x in UUIDs]
228
262
 
284
318
        self.ctx.password = None
285
319
        self.ctx.trust_id = 'atrust123'
286
320
        self.ctx.trustor_user_id = 'atrustor123'
 
321
        self.ctx.tenant_id = 'atenant123'
 
322
        self.ctx.tenant = 'atenant'
287
323
        db_creds = db_api.user_creds_create(self.ctx)
288
324
        load_creds = db_api.user_creds_get(db_creds.id)
289
325
 
290
326
        self.assertIsNone(load_creds.get('username'))
291
327
        self.assertIsNone(load_creds.get('password'))
292
 
        self.assertIsNone(load_creds.get('tenant'))
293
 
        self.assertIsNone(load_creds.get('tenant_id'))
294
328
        self.assertIsNotNone(load_creds.get('created_at'))
295
329
        self.assertIsNone(load_creds.get('updated_at'))
296
330
        self.assertIsNone(load_creds.get('auth_url'))
 
331
        self.assertEqual(load_creds.get('tenant_id'), 'atenant123')
 
332
        self.assertEqual(load_creds.get('tenant'), 'atenant')
297
333
        self.assertEqual(load_creds.get('trust_id'), 'atrust123')
298
334
        self.assertEqual(load_creds.get('trustor_user_id'), 'atrustor123')