Example #1
0
 def MockGsList(path):
     unused = {
         'content_length': None,
         'creation_time': None,
         'generation': None,
         'metageneration': None
     }
     path = path.replace('*', '%s')
     return [
         gs.GSListResult(url=(path % ('4.4', 'R63-9901.21-1506581597')),
                         **unused),
         gs.GSListResult(url=(path % ('3.8', 'R61-9765.70-1506575230')),
                         **unused),
     ]
 def MockGsList(path):
   unused = {
       'content_length': None,
       'creation_time': None,
       'generation': None,
       'metageneration': None
   }
   return [
       gs.GSListResult(url=os.path.join(path, f), **unused) for f in profiles
   ]
Example #3
0
    def mockResult(self, url, expired=True):
        if url.endswith('/'):
            creation_time = None
        else:
            creation_time = self.postExpire if expired else self.preExpire

        return gs.GSListResult(content_length=0,
                               creation_time=creation_time,
                               url=url,
                               generation=0,
                               metageneration=0)
Example #4
0
    def setUp(self):
        self.expireDate = datetime.datetime.now()
        self.preExpire = self.expireDate + datetime.timedelta(minutes=5)
        self.postExpire = self.expireDate - datetime.timedelta(minutes=5)

        self.file_no_timestamp = gs.GSListResult(
            'gs://chromeos-releases/canary-channel/plain_file', None, None,
            None, None)

        self.file_with_timestamp = self.mockResult(
            'gs://chromeos-releases/canary-channel/plain_file')

        self.directory = self.mockResult(
            'gs://chromeos-releases/canary-channel/x86-alex/1.2.3/')