test_item_types_integration.py 文件源码

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

项目:myreco 作者: dutradda 项目源码 文件源码
def test_if_items_patch_updates_stock_filter(self, init_db, headers, redis, session, client, api):
        body = [{
            'name': 'test',
            'stores': [{'id': 1}],
            'schema': {'properties': {'id': {'type': 'string'}}, 'type': 'object', 'id_names': ['id']}
        }]
        client = await client
        await client.post('/item_types/', headers=headers, data=ujson.dumps(body))

        body = [{'id': 'test'}]
        resp = await client.post('/item_types/1/items?store_id=1', headers=headers, data=ujson.dumps(body))
        assert resp.status == 201


        test_model = _all_models['store_items_test_1']
        await ItemsIndicesMap(test_model).update(session)

        body = [{'id': 'test', '_operation': 'delete'}]
        resp = await client.patch('/item_types/1/items?store_id=1', headers=headers, data=ujson.dumps(body))
        stock_filter = np.fromstring(await redis.get('store_items_test_1_stock_filter'), dtype=np.bool).tolist()
        assert stock_filter == [False]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号