当前位置: 首页>>代码示例>>Python>>正文


Python pycall.CallFile类代码示例

本文整理汇总了Python中pycall.CallFile的典型用法代码示例。如果您正苦于以下问题:Python CallFile类的具体用法?Python CallFile怎么用?Python CallFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CallFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_spool_no_time_no_user_error

 def test_spool_no_time_no_user_error(self):
     """Ensure that `spool` raises `NoUserError` if the user attribute is
     not a real system user.
     """
     c = CallFile(self.call, self.action, spool_dir=self.spool_dir,
             user='asjdfgkhkgaskqtjwhkjwetghqekjtbkwthbjkltwhwklt')
     c.spool()
开发者ID:Scinawa,项目名称:pycall,代码行数:7,代码来源:test_callfile.py

示例2: test_buildfile_valid_archive

 def test_buildfile_valid_archive(self):
     """Ensure that `buildfile` works with a well-formed `archive`
     attribute.
     """
     c = CallFile(self.call, self.action, archive=True,
             spool_dir=self.spool_dir)
     ok_('Archive: yes' in ''.join(c.buildfile()))
开发者ID:Scinawa,项目名称:pycall,代码行数:7,代码来源:test_callfile.py

示例3: test_spool_no_time_no_user_permission_error

 def test_spool_no_time_no_user_permission_error(self):
     """Ensure that `spool` raises `NoUserPermissionError` if the user
     specified does not have permissions to write to the Asterisk spooling
     directory.
     """
     c = CallFile(self.call, self.action, spool_dir='/', user='root')
     c.spool()
开发者ID:Scinawa,项目名称:pycall,代码行数:7,代码来源:test_callfile.py

示例4: test_spool_no_time_no_user

 def test_spool_no_time_no_user(self):
     """Ensure `spool` works when no `time` attribute is supplied, and no
     `user` attribute exists.
     """
     c = CallFile(self.call, self.action, spool_dir=self.spool_dir)
     c.spool()
     ok_((path(c.spool_dir) / path(c.filename)).abspath().exists())
开发者ID:Scinawa,项目名称:pycall,代码行数:7,代码来源:test_callfile.py

示例5: test_spool_no_time_user

 def test_spool_no_time_user(self):
     """Ensure that `spool` works when no `time` attribute is specified, and
     a valid `user` attribute exists.
     """
     c = CallFile(self.call, self.action, spool_dir=self.spool_dir,
             user=getuser())
     c.spool()
开发者ID:Scinawa,项目名称:pycall,代码行数:7,代码来源:test_callfile.py

示例6: test_spool_no_time_no_spool_permission_error

    def test_spool_no_time_no_spool_permission_error(self):
        """Ensure that `spool` raises `NoSpoolPermissionError` if the user
        doesn't have permissions to write to `spool_dir`.

        NOTE: This test WILL fail if the user account you run this test under
        has write access to the / directory on your local filesystem.
        """
        c = CallFile(self.call, self.action, spool_dir='/')
        c.spool()
开发者ID:Scinawa,项目名称:pycall,代码行数:9,代码来源:test_callfile.py

示例7: dialout

def dialout():
    call_from = request.args.get('from', '')
    call_to = request.args.get('to', '')
    cfrom = 'SIP/{}@hotvoip'.format(call_from)
    cto = 'SIP/{}@hotvoip'.format(call_to)
    c = Call(cfrom)
    a = Application('Dial', cto)
    cf = CallFile(c, a)
    cf.spool()
    return 'dialed'
开发者ID:boyombo,项目名称:asterisk-pycall-flask,代码行数:10,代码来源:app.py

示例8: localcall

def localcall():
    call_from = request.args.get('from', '')
    call_to = request.args.get('to', '')
    if call_from and call_to:
        cfrom = 'SIP/{}'.format(call_from)
        logging.debug(cfrom)
        cto = 'SIP/{}'.format(call_to)
        logging.debug(cto)
        c = Call(cfrom)
        a = Application('Dial', cto)
        cf = CallFile(c, a)
        cf.spool()
    else:
        return "no call made"
    return "call made"
开发者ID:boyombo,项目名称:asterisk-pycall-flask,代码行数:15,代码来源:app.py

示例9: test_is_valid_invalid_spool_dir

 def test_is_valid_invalid_spool_dir(self):
     """Ensure `is_valid` fails given an invalid `spool_dir` attribute."""
     c = CallFile(self.call, self.action, spool_dir='/woot')
     assert_false(c.is_valid())
开发者ID:Scinawa,项目名称:pycall,代码行数:4,代码来源:test_callfile.py

示例10: test_is_valid_invalid_action

 def test_is_valid_invalid_action(self):
     """Ensure `is_valid` fails given an invalid `action` attribute."""
     c = CallFile(self.call, 'action', spool_dir=self.spool_dir)
     assert_false(c.is_valid())
开发者ID:Scinawa,项目名称:pycall,代码行数:4,代码来源:test_callfile.py

示例11: test_is_valid_invalid_call

 def test_is_valid_invalid_call(self):
     """Ensure `is_valid` fails given an invalid `call` attribute."""
     c = CallFile('call', self.action, spool_dir=self.spool_dir)
     assert_false(c.is_valid())
开发者ID:Scinawa,项目名称:pycall,代码行数:4,代码来源:test_callfile.py

示例12: test_is_valid_valid_call_is_valid

 def test_is_valid_valid_call_is_valid(self):
     """Ensure `is_valid` works when `call.is_valid()` works."""
     c = CallFile(self.call, self.action, spool_dir=self.spool_dir)
     ok_(c.is_valid())
开发者ID:Scinawa,项目名称:pycall,代码行数:4,代码来源:test_callfile.py

示例13: test_is_valid_valid_spool_dir

 def test_is_valid_valid_spool_dir(self):
     """Ensure `is_valid` works using a valid `spool_dir` attribute."""
     c = CallFile(self.call, self.action, spool_dir=self.spool_dir)
     ok_(c.is_valid())
开发者ID:Scinawa,项目名称:pycall,代码行数:4,代码来源:test_callfile.py

示例14: test_str

 def test_str(self):
     """Ensure `__str__` works."""
     c = CallFile(self.call, self.action, spool_dir=self.spool_dir)
     ok_('archive' in c.__str__() and 'user' in c.__str__() and
         'spool_dir' in c.__str__())
开发者ID:Scinawa,项目名称:pycall,代码行数:5,代码来源:test_callfile.py

示例15: test_spool_time_no_user

 def test_spool_time_no_user(self):
     """Ensure that `spool` works when given a valid `time` parameter."""
     c = CallFile(self.call, self.action, spool_dir=self.spool_dir)
     d = datetime.now()
     c.spool(d)
     eq_((path(c.tempdir) / path(c.filename)).abspath().atime, mktime(d.timetuple()))
开发者ID:Scinawa,项目名称:pycall,代码行数:6,代码来源:test_callfile.py


注:本文中的pycall.CallFile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。