示例#1
0
 def test_validate_bad_interface(self):
     han = TestHandler2()
     try:
         interface.validate(TestInterface, han, [])
     except exc.InterfaceError as e:
         self.eq(e.msg, "%s does not implement %s." % (han, TestInterface))
         raise
示例#2
0
 def test_validate_bad_interface_missing_meta(self):
     han = TestHandler()
     try:
         interface.validate(TestInterface, han, [], ['missing_meta'])
     except exc.InterfaceError as e:
         self.eq(e.msg, "Invalid or missing: ['_meta.missing_meta'] in %s" % han)
         raise
示例#3
0
 def test_validate_bad_interface(self):
     han = TestHandler2()
     try:
         interface.validate(TestInterface, han, [])
     except exc.InterfaceError as e:
         self.eq(e.msg, "%s does not implement %s." % (han, TestInterface))
         raise
示例#4
0
 def test_validate_bad_interface_no_meta(self):
     han = TestHandler3()
     try:
         interface.validate(TestInterface, han, [])
     except exc.InterfaceError as e:
         self.eq(e.msg, "Invalid or missing: ['_meta'] in %s" % han)
         raise
示例#5
0
def cmd_interface_validator(cls, obj):
    members = [
        '_setup',
        'command',
        'monitor',
    ]
    interface.validate(ICommand, obj, members)
示例#6
0
def cmd_interface_validator(cls, obj):
    members = [
        '_setup',
        'command',
        'monitor',
        ]
    interface.validate(ICommand, obj, members)
示例#7
0
文件: __init__.py 项目: percyfal/pm
def wrapper_interface_validator(cls, obj):
    members = [
        'cl', 
        'cmd_args',
        'version',
        ]
    interface.validate(IWrapper, obj, members)
示例#8
0
def database_validator(klass, obj):
    """Verify that a handler satisfies the Database interface."""
    members = [
        '__setitem__',
        '__getitem__',
    ]
    validate(IDatabase, obj, members)
示例#9
0
def rest_api_validator(klass, obj):
    """Validates an handler implementation against the IREST interface."""

    members = [
        '_setup',
        'reset',
        'resources',
        'make_request',
    ]
    interface.validate(IRESTApi, obj, members)
示例#10
0
文件: server.py 项目: tpoeppke/reds
def server_validator(class_, obj):
    members = [
        "_setup",
        "start",
        "stop",
        "_run",
        "exit",
        ]
    
    interface.validate(IServerManager, obj, members)
示例#11
0
文件: efs.py 项目: tpoeppke/reds
def encryptedfs_validator(class_, obj):
    members = [
        "_setup",
        "mount",
        "mkfs",
        "umount",
        "is_mounted_at",
        ]
    
    interface.validate(IEncryptedFS, obj, members)
示例#12
0
def versioncontrol_validator(class_, obj):
    members = [
        "_setup",
        "setup_repository",
        "new_repository",
        "get_repos_path",
        "is_versioncontrol_command",
        "get_needed_permission",
        "get_sane_command"
        ]
    
    interface.validate(IVersionControl, obj, members)
示例#13
0
 def test_validator(self):
     interface.validate(TestInterface, TestHandler(), [])
示例#14
0
 def test_validator(self):
     interface.validate(TestInterface, TestHandler(), [])
示例#15
0
def cmd_interface_validator(cls, obj):
    members = ["_setup", "command", "monitor"]
    interface.validate(ICommand, obj, members)