@@ -344,6 +344,116 @@ def test_make_public(self):
344344 self .assertEqual (kw [0 ]['data' ], {'acl' : permissive })
345345 self .assertEqual (kw [0 ]['query_params' ], {'projection' : 'full' })
346346
347+ def test_component_count (self ):
348+ KEY = 'key'
349+ connection = _Connection ()
350+ bucket = _Bucket (connection )
351+ COMPONENT_COUNT = 42
352+ properties = {'componentCount' : COMPONENT_COUNT }
353+ key = self ._makeOne (bucket , KEY , properties )
354+ self .assertEqual (key .component_count , COMPONENT_COUNT )
355+
356+ def test_etag (self ):
357+ KEY = 'key'
358+ connection = _Connection ()
359+ bucket = _Bucket (connection )
360+ ETAG = 'ETAG'
361+ properties = {'etag' : ETAG }
362+ key = self ._makeOne (bucket , KEY , properties )
363+ self .assertEqual (key .etag , ETAG )
364+
365+ def test_generation (self ):
366+ KEY = 'key'
367+ connection = _Connection ()
368+ bucket = _Bucket (connection )
369+ GENERATION = 42
370+ properties = {'generation' : GENERATION }
371+ key = self ._makeOne (bucket , KEY , properties )
372+ self .assertEqual (key .generation , GENERATION )
373+
374+ def test_id (self ):
375+ KEY = 'key'
376+ connection = _Connection ()
377+ bucket = _Bucket (connection )
378+ ID = 'ID'
379+ properties = {'id' : ID }
380+ key = self ._makeOne (bucket , KEY , properties )
381+ self .assertEqual (key .id , ID )
382+
383+ def test_media_link (self ):
384+ KEY = 'key'
385+ connection = _Connection ()
386+ bucket = _Bucket (connection )
387+ MEDIA_LINK = 'http://example.com/media/'
388+ properties = {'selfLink' : MEDIA_LINK }
389+ key = self ._makeOne (bucket , KEY , properties )
390+ self .assertEqual (key .media_link , MEDIA_LINK )
391+
392+ def test_metageneration (self ):
393+ KEY = 'key'
394+ connection = _Connection ()
395+ bucket = _Bucket (connection )
396+ METAGENERATION = 42
397+ properties = {'metageneration' : METAGENERATION }
398+ key = self ._makeOne (bucket , KEY , properties )
399+ self .assertEqual (key .metageneration , METAGENERATION )
400+
401+ def test_owner (self ):
402+ KEY = 'key'
403+ connection = _Connection ()
404+ bucket = _Bucket (connection )
405+ OWNER = {'entity' : 'project-owner-12345' , 'entityId' : '23456' }
406+ properties = {'owner' : OWNER }
407+ key = self ._makeOne (bucket , KEY , properties )
408+ owner = key .owner
409+ self .assertEqual (owner ['entity' ], 'project-owner-12345' )
410+ self .assertEqual (owner ['entityId' ], '23456' )
411+
412+ def test_self_link (self ):
413+ KEY = 'key'
414+ connection = _Connection ()
415+ bucket = _Bucket (connection )
416+ SELF_LINK = 'http://example.com/self/'
417+ properties = {'selfLink' : SELF_LINK }
418+ key = self ._makeOne (bucket , KEY , properties )
419+ self .assertEqual (key .self_link , SELF_LINK )
420+
421+ def test_size (self ):
422+ KEY = 'key'
423+ connection = _Connection ()
424+ bucket = _Bucket (connection )
425+ SIZE = 42
426+ properties = {'size' : SIZE }
427+ key = self ._makeOne (bucket , KEY , properties )
428+ self .assertEqual (key .size , SIZE )
429+
430+ def test_storage_class (self ):
431+ KEY = 'key'
432+ connection = _Connection ()
433+ bucket = _Bucket (connection )
434+ STORAGE_CLASS = 'http://example.com/self/'
435+ properties = {'storageClass' : STORAGE_CLASS }
436+ key = self ._makeOne (bucket , KEY , properties )
437+ self .assertEqual (key .storage_class , STORAGE_CLASS )
438+
439+ def test_time_deleted (self ):
440+ KEY = 'key'
441+ connection = _Connection ()
442+ bucket = _Bucket (connection )
443+ TIME_DELETED = '2014-11-05T20:34:37Z'
444+ properties = {'timeDeleted' : TIME_DELETED }
445+ key = self ._makeOne (bucket , KEY , properties )
446+ self .assertEqual (key .time_deleted , TIME_DELETED )
447+
448+ def test_updated (self ):
449+ KEY = 'key'
450+ connection = _Connection ()
451+ bucket = _Bucket (connection )
452+ UPDATED = '2014-11-05T20:34:37Z'
453+ properties = {'updated' : UPDATED }
454+ key = self ._makeOne (bucket , KEY , properties )
455+ self .assertEqual (key .updated , UPDATED )
456+
347457
348458class Test__KeyIterator (unittest2 .TestCase ):
349459
0 commit comments