小编Mat*_*ain的帖子

specflow禁用,SpecflowPackagePackage没有正确加载

在此输入图像描述我在Visual Studio扩展中仍然禁用Specflow的问题.

当我启动VS时,我收到错误SpecflowPackagePackage没有正确加载.

我试图卸载并重新安装specflow但它似乎很奇怪.当我卸载它说卸载成功并要求重新启动VS. 当我重新启动时,Specflow仍然存在,但已禁用.

使用Visual Studio 2015,更新3,64位.Windows 10. Specflow版本2017.1.6

c# bdd visual-studio specflow

6
推荐指数
2
解决办法
2400
查看次数

使用flask restplus 进行api 记录的特定时间格式

我有一个 api,它在请求的正文中接受 start_time、end_time 和一个布尔值 closed_all_day。

from flask_restplus import Namespace, fields

timings = api.model('open times', {
     'start_time': fields.String(required=True, description='Time in 24 hour HH:MM format, defaulted to 00:00 if closed_all_day'),
     'end_time': fields.String(required=True, description='Time in 24 hour HH:MM format, defaulted to 00:00 if closed_all_day'),
     'closed_all_day': fields.Boolean(required=True, description='If True overwrites start_time and end_time')
})
Run Code Online (Sandbox Code Playgroud)

start_time 和 end_time 的格式为 HH:MM(24 小时格式)

如果我使用

fields.Date
Run Code Online (Sandbox Code Playgroud)

或者

fields.DateTime
Run Code Online (Sandbox Code Playgroud)

然后我得到了完整的 ISO 日期格式,这也不是我想要的。

有没有办法将输入限制为 HH:MM 格式?

python swagger flask-restplus

5
推荐指数
1
解决办法
2379
查看次数

aws身份池过滤器在多个条件下列出用户api

有没有办法在多个条件下过滤列表用户 api 的结果。我想从列表中获取具有用户名的所有用户的列表

import boto3
client = boto3.client('cognito-idp')
client.list_users(UserPoolId='us-east-1_123456789', AttributesToGet=['email'], Filter="username =\"user_name_1\"")
Run Code Online (Sandbox Code Playgroud)

上面的代码只返回我一个用户名。现在,如果我想获取多个用户名的相同信息,我似乎找不到方法来做到这一点。

前任:

import boto3
usernames=['user_id1','user_id2']
client = boto3.client('cognito-idp')
client.list_users(UserPoolId='us-east-1_123456789', AttributesToGet=['email'], Filter="username =usernames")
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-cognito boto3 aws-userpools

5
推荐指数
1
解决办法
9443
查看次数

使用烧瓶返回 bool 作为 POST 响应

我正在模拟一个 Post api(用 C# 编写),它在调用时返回一个布尔值 true 或 false。请求的内容类型是 application/json

true
Run Code Online (Sandbox Code Playgroud)

我现在正在尝试使用 Flask 在 Python 中模拟该端点,并且我正在努力让它传递一个布尔值。

我试过

return make_response(True,200)
Run Code Online (Sandbox Code Playgroud)

或者干脆

return True
Run Code Online (Sandbox Code Playgroud)

在这两种情况下,api 都无法发送所需的响应并引发错误。

在绝望的尝试中,我尝试将“True”作为字符串返回

return make_response("True", 200)
Run Code Online (Sandbox Code Playgroud)

这似乎在模拟级别工作,但消费代码 (c#) 失败,因为它尝试将该返回值转换为 bool

result = response.Content.ReadAsAsync<bool>().Result
Run Code Online (Sandbox Code Playgroud)

关于如何使模拟 api 返回 bool 值的任何想法???

python api boolean return flask

2
推荐指数
1
解决办法
1万
查看次数

pytest 传递数据进行清理

我正在为 post api 编写测试,它返回创建的资源。但是如何将这些数据传递给 python 中的夹具,以便在测试完成后进行清理

清理:

@pytest.fixture(scope='function')
def delete_after_post(request):
    def cleanup():
        // Get ID of resource to cleanup
        // Call Delete api with ID to delete the resource
    request.addfinalizer(cleanup)
Run Code Online (Sandbox Code Playgroud)

测试:

 def test_post(delete_after_post):
     Id = post(api)
     assert Id
Run Code Online (Sandbox Code Playgroud)

将响应(ID)传递回夹具以进行清理的最佳方法是什么。不想将清理作为测试的一部分。

python pytest web-api-testing

2
推荐指数
1
解决办法
3427
查看次数

来自 gobal 模块的笑话模拟常量

我正在玩 Jest,并努力弄清楚如何模拟一个对象。我看到的大多数示例都展示了如何模拟函数。

这是我的组件AboutScreen.js

import React from 'react';
import { Constants, WebBrowser } from 'expo';
import { View, Text } from 'react-native';
import config from '../config';

const AboutScreen = () => {
const { termsAndConditionsUrl, privacyPolicyUrl } = config;
const { releaseChannel, version } = Constants.manifest;
const channel = (releaseChannel === undefined) ? 'DEV' : releaseChannel;
return (
    <View>
        <Text>Version: {version}, Release-channel: {channel}</Text>
        <Text testId={"t-and-c"} onPress={() => WebBrowser.openBrowserAsync(termsAndConditionsUrl)}>
    Terms & conditions
        </Text>
    </View>
  );
};


export default AboutScreen;
Run Code Online (Sandbox Code Playgroud)

我的测试AboutScreen.test.js …

mocking jestjs expo

1
推荐指数
1
解决办法
6427
查看次数