403Webshell
Server IP : 101.53.144.229  /  Your IP : 216.73.216.181
Web Server : Apache
System : Linux host.gdigitalindia.in 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : digitalshiksha ( 1179)
PHP Version : 5.6.40
Disable Function : eval,show_source,system,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,dl,show_source,curl_multi_exechellcmd, ini_restore,apache_get_modules,get_cfg_var,passthru, exec ,proc_get_status,fpassthru,c999_buff_prepare,c999_sess_put,c99_buff_prepare,c99_sess_put,proc_close,ini_alter,dl,symlink,link,proc_close,ini_alter,dl,symlink,link,mail
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/self/cwd/c1/1/opt/alt/python35/lib/python3.5/site-packages/cerberus/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/cwd/c1/1/opt/alt/python35/lib/python3.5/site-packages/cerberus/tests/conftest.py
# -*- coding: utf-8 -*-

from copy import deepcopy

import pytest

from cerberus import Validator


@pytest.fixture
def document():
    return deepcopy(sample_document)


@pytest.fixture
def schema():
    return deepcopy(sample_schema)


@pytest.fixture
def validator():
    return Validator(sample_schema)


sample_schema = {
    'a_string': {
        'type': 'string',
        'minlength': 2,
        'maxlength': 10
    },
    'a_binary': {
        'type': 'binary',
        'minlength': 2,
        'maxlength': 10
    },
    'a_nullable_integer': {
        'type': 'integer',
        'nullable': True
    },
    'an_integer': {
        'type': 'integer',
        'min': 1,
        'max': 100,
    },
    'a_restricted_integer': {
        'type': 'integer',
        'allowed': [-1, 0, 1],
    },
    'a_boolean': {
        'type': 'boolean',
    },
    'a_datetime': {
        'type': 'datetime',
    },
    'a_float': {
        'type': 'float',
        'min': 1,
        'max': 100,
    },
    'a_number': {
        'type': 'number',
        'min': 1,
        'max': 100,
    },
    'a_set': {
        'type': 'set',
    },
    'one_or_more_strings': {
        'type': ['string', 'list'],
        'schema': {'type': 'string'}
    },
    'a_regex_email': {
        'type': 'string',
        'regex': '^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$'
    },
    'a_readonly_string': {
        'type': 'string',
        'readonly': True,
    },
    'a_restricted_string': {
        'type': 'string',
        'allowed': ["agent", "client", "vendor"],
    },
    'an_array': {
        'type': 'list',
        'allowed': ["agent", "client", "vendor"],
    },
    'a_list_of_dicts': {
        'type': 'list',
        'schema': {
            'type': 'dict',
            'schema': {
                'sku': {'type': 'string'},
                'price': {'type': 'integer', 'required': True},
            },
        },
    },
    'a_list_of_values': {
        'type': 'list',
        'items': [{'type': 'string'}, {'type': 'integer'}, ]
    },
    'a_list_of_integers': {
        'type': 'list',
        'schema': {'type': 'integer'},
    },
    'a_dict': {
        'type': 'dict',
        'schema': {
            'address': {'type': 'string'},
            'city': {'type': 'string', 'required': True}
        },
    },
    'a_dict_with_valueschema': {
        'type': 'dict',
        'valueschema': {'type': 'integer'}
    },
    'a_dict_with_keyschema': {
        'type': 'dict',
        'keyschema': {'type': 'string', 'regex': '[a-z]+'}
    },
    'a_list_length': {
        'type': 'list',
        'schema': {'type': 'integer'},
        'minlength': 2,
        'maxlength': 5,
    },
    'a_nullable_field_without_type': {
        'nullable': True
    },
    'a_not_nullable_field_without_type': {
    },
}

sample_document = {'name': 'john doe'}

Youez - 2016 - github.com/yon3zu
LinuXploit