单元测试Google的Cloud Storage API [英] Unit testing Google's Cloud Storage API

查看:448
本文介绍了单元测试Google的Cloud Storage API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个API端点,我正在尝试编写单元测试,我似乎无法弄清楚如何单元测试Python Google Cloud Storage客户端库调用( https://cloud.google.com/appengine/docs/python/googlecloudstorageclient/ )。
我希望在库中的某个地方找到一个存根,并且像单元测试一样简单,邮件API就是( https://cloud.google.com/appengine/docs/python/tools/localunittesting?hl=zh_CN ),但未发现任何内容然而。任何想法如何去做这件事?

可用单元测试列表未列出GCS 。您可以在 GitHub 上提交功能请求以添加该功能。



同时,使用setUp进行测试来创建文件可能是您最好的选择。


I have an API endpoint I'm trying to write unit tests for and I can't seem to figure out how to unit test the Python Google Cloud Storage client library calls (https://cloud.google.com/appengine/docs/python/googlecloudstorageclient/). I was hoping to find a stub somewhere in the library and have it be as simple as unit testing the mail API would be (https://cloud.google.com/appengine/docs/python/tools/localunittesting?hl=en), but haven't found anything yet. Any idea how to go about this?

解决方案

The list of available unit test does not list GCS. You can file a feature request on their GitHub to add that functionality.

In the mean time using the setUp for your tests to create files is probably your best bet.

这篇关于单元测试Google的Cloud Storage API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆