コード例 #1
0
 def test_success(self):
     file = 'amazon-dash.yml'
     with Patcher() as patcher:
         patcher.fs.CreateFile(file, contents=config_data)
         os.chown(file, 0, 0)
         os.chmod(file, 0o600)
         check_config(file, lambda x: x)
コード例 #2
0
 def test_fail(self):
     file = 'amazon-dash.yml'
     with Patcher() as patcher:
         patcher.fs.CreateFile(file, contents='invalid config')
         os.chown(file, 0, 0)
         os.chmod(file, 0o600)
         with self.assertRaises(InvalidConfig):
             check_config(file)
コード例 #3
0
ファイル: management.py プロジェクト: wtsxgba/amazon-dash
def execute_args(args):
    """Execute args.which command

    :param args: argparse args
    :return: None
    """
    if not getattr(args, 'which', None) or args.which == 'run':
        Listener(args.config).run(root_allowed=args.root_allowed)
    elif args.which == 'check-config':
        check_config(args.config)
    elif args.which == 'test-device':
        test_device(args.device, args.config, args.root_allowed)
    elif args.which == 'discovery':
        from amazon_dash.discovery import discover
        discover()
コード例 #4
0
ファイル: management.py プロジェクト: saibotlv2/amazon-dash
def check_config(config):
    from amazon_dash.config import check_config
    check_config(config)