@@ -1115,11 +1115,24 @@ def _get_target_class():
11151115 def _make_one (self , * args , ** kw ):
11161116 return self ._get_target_class ()(* args , ** kw )
11171117
1118+ def _setUpConstants (self ):
1119+ import datetime
1120+ from google .cloud ._helpers import UTC
1121+
1122+ self .WHEN_TS = 1437767599.125
1123+ self .WHEN = datetime .datetime .utcfromtimestamp (self .WHEN_TS ).replace (tzinfo = UTC )
1124+ self .EXP_TIME = datetime .datetime (2015 , 8 , 1 , 23 , 59 , 59 , tzinfo = UTC )
1125+
11181126 def test_ctor (self ):
1127+ from google .cloud ._helpers import _millis
1128+
1129+ self ._setUpConstants ()
11191130 project = "test-project"
11201131 dataset_id = "test_dataset"
11211132 table_id = "coffee_table"
11221133 resource = {
1134+ "creationTime" : self .WHEN_TS * 1000 ,
1135+ "expirationTime" : _millis (self .EXP_TIME ),
11231136 "kind" : "bigquery#table" ,
11241137 "id" : "{}:{}.{}" .format (project , dataset_id , table_id ),
11251138 "tableReference" : {
@@ -1138,6 +1151,9 @@ def test_ctor(self):
11381151 }
11391152
11401153 table = self ._make_one (resource )
1154+
1155+ self .assertEqual (table .created , self .WHEN )
1156+ self .assertEqual (table .expires , self .EXP_TIME )
11411157 self .assertEqual (table .project , project )
11421158 self .assertEqual (table .dataset_id , dataset_id )
11431159 self .assertEqual (table .table_id , table_id )
@@ -1204,6 +1220,8 @@ def test_ctor_missing_properties(self):
12041220 self .assertEqual (table .project , "testproject" )
12051221 self .assertEqual (table .dataset_id , "testdataset" )
12061222 self .assertEqual (table .table_id , "testtable" )
1223+ self .assertIsNone (table .created )
1224+ self .assertIsNone (table .expires )
12071225 self .assertIsNone (table .full_table_id )
12081226 self .assertIsNone (table .friendly_name )
12091227 self .assertIsNone (table .table_type )
0 commit comments