Exemple #1
0
    def test_delete(self):
        rule = test_security_groups.security_group_rule_template(
            parent_group_id=self.sg2['id'])

        req = fakes.HTTPRequest.blank('/v2/fake/os-security-group-rules')
        res_dict = self.controller.create(req, {'security_group_rule': rule})
        security_group_rule = res_dict['security_group_rule']
        req = fakes.HTTPRequest.blank('/v2/fake/os-security-group-rules/%s'
                                      % security_group_rule['id'])
        self.controller.delete(req, security_group_rule['id'])
Exemple #2
0
 def test_create_add_existing_rules_by_group_id(self):
     sg = test_security_groups.security_group_template()
     req = fakes.HTTPRequest.blank('/v2/fake/os-security-groups')
     self.controller_sg.create(req, {'security_group': sg})
     rule = test_security_groups.security_group_rule_template(
         group=self.sg1['id'], parent_group_id=self.sg2['id'])
     req = fakes.HTTPRequest.blank('/v2/fake/os-security-group-rules')
     self.controller.create(req, {'security_group_rule': rule})
     self.assertRaises(webob.exc.HTTPBadRequest, self.controller.create,
                       req, {'security_group_rule': rule})