test_security_groups_client.py 文件源码

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

项目:quark 作者: openstack 项目源码 文件源码
def test_apply_rules(self, strict_redis, uuid4):
        client = sg_client.SecurityGroupsClient()
        device_id = "device"
        uuid4.return_value = "uuid"

        mac_address = netaddr.EUI("AA:BB:CC:DD:EE:FF")
        client.apply_rules(device_id, mac_address.value, [])
        self.assertTrue(client._client.master.hset.called)

        redis_key = client.vif_key(device_id, mac_address.value)

        rule_dict = {"rules": []}

        client._client.master.hset.assert_any_call(
            redis_key, sg_client.SECURITY_GROUP_HASH_ATTR,
            json.dumps(rule_dict))

        client._client.master.hset.assert_any_call(
            redis_key, sg_client.SECURITY_GROUP_ACK, False)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号