def test_retrieve_meta_returns_meta_when_added(self):
     data = cStringIO.StringIO('test file data')
     digest = md5_from_stream(data)
     expected_meta = {'content-type': 'application/json', 'file-size': 20}
     self.blob_service.add(data, meta=expected_meta)
     actual_meta = self.blob_service.retrieve_meta(digest)
     self.assertEqual(expected_meta, actual_meta)
    def test_retrieve_uri_returns_string_uri_if_blob_is_found(self):
        data = cStringIO.StringIO('test file data')
        digest = md5_from_stream(data)
        self.blob_service.add(data, digest=digest)
        uri = self.blob_service.retrieve_uri(digest)

        self.assertIsNotNone(uri)
        self.assertEqual(type(uri), str)
 def test_add_returns_correct_digest_when_digest_is_added(self):
     data = cStringIO.StringIO('some-data')
     actual_digest = md5_from_stream(data)
     expected_digest = self.blob_service.add(data, digest=actual_digest)
     self.assertEqual(actual_digest, expected_digest)
 def test_get_data_returns_data_if_added(self):
     data = cStringIO.StringIO('some-data')
     digest = self.blob_service.add(data)
     actual_data = self.blob_service.get_data(digest)
     self.assertEqual(md5_from_stream(actual_data), digest)
 def test_retrieve_meta_returns_empty_dict_when_no_meta_added(self):
     data = cStringIO.StringIO('test file data')
     digest = md5_from_stream(data)
     self.blob_service.add(data, digest=digest)
     self.assertEqual(self.blob_service.retrieve_meta(digest), {})