test_enroll.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:Chatagram 作者: karanchahal 项目源码 文件源码
def test_passes_required_arguments_in_payload_as_json_when_image_is_file(self, post_mock):
        post_mock.return_value.status_code = 200

        m = mock.mock_open(read_data=str.encode('test'))
        with mock.patch('builtins.open', m, create=True):
            kairos_face.enroll_face('sub_id', 'gallery', file='/a/image/file.jpg')

        _, kwargs = post_mock.call_args
        expected_payload = {
            'image': 'dGVzdA==',
            'subject_id': 'sub_id',
            'gallery_name': 'gallery',
            'multiple_faces': False
        }
        self.assertTrue('json' in kwargs)
        self.assertEqual(expected_payload, kwargs['json'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号