def test_validate_data_method_with_empty_data(self):
        validator = FdmSwaggerValidator(mock_data)
        valid, rez = validator.validate_data('getNetworkObjectList', None)
        assert not valid
        assert sort_validator_rez({
            'required': ['subType', 'type', 'value']
        }) == sort_validator_rez(rez)

        self.check_illegal_argument_exception(lambda: validator.validate_data('getNetworkObjectList', ''),
                                              "The data parameter must be a dict")

        self.check_illegal_argument_exception(lambda: validator.validate_data('getNetworkObjectList', []),
                                              "The data parameter must be a dict")
        valid, rez = validator.validate_data('getNetworkObjectList', {})
        assert not valid
        assert sort_validator_rez({
            'required': ['subType', 'type', 'value']
        }) == sort_validator_rez(rez)

        self.check_illegal_argument_exception(lambda: validator.validate_data(None, {'name': 'test'}),
                                              "The operation_name parameter must be a non-empty string")

        self.check_illegal_argument_exception(lambda: validator.validate_data('', {'name': 'test'}),
                                              "The operation_name parameter must be a non-empty string")

        self.check_illegal_argument_exception(lambda: validator.validate_data([], {'name': 'test'}),
                                              "The operation_name parameter must be a non-empty string")

        self.check_illegal_argument_exception(lambda: validator.validate_data({}, {'name': 'test'}),
                                              "The operation_name parameter must be a non-empty string")

        self.check_illegal_argument_exception(
            lambda: validator.validate_data('operation_does_not_exist', {'name': 'test'}),
            "operation_does_not_exist operation does not support")
    def test_with_all_data(self):
        fdm_data = FdmSwaggerParser().parse_spec(self.base_data)
        validator = FdmSwaggerValidator(fdm_data)
        models = fdm_data['models']
        operations = fdm_data['operations']

        invalid = set({})
        for operation in operations:
            model_name = operations[operation]['modelName']
            method = operations[operation]['method']
            if method != 'get' and model_name in models:
                if 'example' in models[model_name]:
                    example = models[model_name]['example']
                    try:
                        valid, rez = validator.validate_data(operation, example)
                        assert valid
                    except Exception:
                        invalid.add(model_name)
        assert invalid == set(['TCPPortObject',
                               'UDPPortObject',
                               'ICMPv4PortObject',
                               'ICMPv6PortObject',
                               'StandardAccessList',
                               'ExtendedAccessList',
                               'ASPathList',
                               'RouteMap',
                               'StandardCommunityList',
                               'ExpandedCommunityList',
                               'IPV4PrefixList',
                               'IPV6PrefixList',
                               'PolicyList',
                               'SyslogServer',
                               'HAConfiguration',
                               'TestIdentitySource'])