Пример #1
0
 def test_get_md5_cached_write(self):
   lorem_ipsum2 = os.path.join(self.base_path, 'lorem_ipsum2.txt')
   lorem_ipsum2_md5 = os.path.join(self.base_path, 'lorem_ipsum2.txt.md5')
   if os.path.exists(lorem_ipsum2_md5):
     os.remove(lorem_ipsum2_md5)
   # Use a fake 'stale' MD5 sum.  Expected behavior is to return stale sum.
   self.assertEqual(
       upload_to_google_storage.get_md5_cached(lorem_ipsum2),
       '4c02d1eb455a0f22c575265d17b84b6d')
   self.assertTrue(os.path.exists(lorem_ipsum2_md5))
   self.assertEqual(
       open(lorem_ipsum2_md5, 'rb').read(),
       '4c02d1eb455a0f22c575265d17b84b6d')
   os.remove(lorem_ipsum2_md5)  # Clean up.
   self.assertFalse(os.path.exists(lorem_ipsum2_md5))
 def test_get_md5_cached_write(self):
   lorem_ipsum2 = os.path.join(self.base_path, 'lorem_ipsum2.txt')
   lorem_ipsum2_md5 = os.path.join(self.base_path, 'lorem_ipsum2.txt.md5')
   if os.path.exists(lorem_ipsum2_md5):
     os.remove(lorem_ipsum2_md5)
   # Use a fake 'stale' MD5 sum.  Expected behavior is to return stale sum.
   self.assertEqual(
       upload_to_google_storage.get_md5_cached(lorem_ipsum2),
       '4c02d1eb455a0f22c575265d17b84b6d')
   self.assertTrue(os.path.exists(lorem_ipsum2_md5))
   self.assertEqual(
       open(lorem_ipsum2_md5, 'rb').read(),
       '4c02d1eb455a0f22c575265d17b84b6d')
   os.remove(lorem_ipsum2_md5)  # Clean up.
   self.assertFalse(os.path.exists(lorem_ipsum2_md5))
 def test_get_md5_cached_read(self):
     lorem_ipsum = os.path.join(self.base_path, 'lorem_ipsum.txt')
     # Use a fake 'stale' MD5 sum.  Expected behavior is to return stale sum.
     self.assertEqual(upload_to_google_storage.get_md5_cached(lorem_ipsum),
                      '734d7c1ed3545383837428f031840a1e')
Пример #4
0
 def test_get_md5_cached_read(self):
   lorem_ipsum = os.path.join(self.base_path, 'lorem_ipsum.txt')
   # Use a fake 'stale' MD5 sum.  Expected behavior is to return stale sum.
   self.assertEqual(
       upload_to_google_storage.get_md5_cached(lorem_ipsum),
       '734d7c1ed3545383837428f031840a1e')