~ubuntu-branches/ubuntu/trusty/sflphone/trusty

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.1.0/tests/pjsua/mod_sendto.py

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (4.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20140128182336-jrsv0k9u6cawc068
Tags: 1.3.0-1
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# $Id: mod_sendto.py 3243 2010-08-01 09:48:51Z bennylp $
 
2
import imp
 
3
import sys
 
4
import inc_sip as sip
 
5
import inc_const as const
 
6
import re
 
7
from inc_cfg import *
 
8
 
 
9
# Read configuration
 
10
cfg_file = imp.load_source("cfg_file", ARGS[1])
 
11
 
 
12
# Test body function
 
13
def test_func(t):
 
14
        pjsua = t.process[0]
 
15
        # Create dialog
 
16
        dlg = sip.Dialog("127.0.0.1", pjsua.inst_param.sip_port, 
 
17
                          tcp=cfg_file.sendto_cfg.use_tcp)
 
18
        #dlg = sip.Dialog("127.0.0.1", 5060, tcp=cfg_file.sendto_cfg.use_tcp)
 
19
        cfg = cfg_file.sendto_cfg
 
20
        
 
21
        if len(cfg.complete_msg) != 0:
 
22
                req = dlg.update_fields(cfg.complete_msg)
 
23
        else:
 
24
                req = dlg.create_invite(cfg.sdp, cfg.extra_headers, cfg.body)
 
25
        resp = dlg.send_request_wait(req, 10)
 
26
        if resp=="":
 
27
                raise TestError("Timed-out waiting for response")
 
28
        # Check response code
 
29
        code = int(sip.get_code(resp))
 
30
        if code != cfg.resp_code:
 
31
                dlg.hangup(code)
 
32
                raise TestError("Expecting code " + str(cfg.resp_code) + 
 
33
                                " got " + str(code))
 
34
        # Check for patterns that must exist
 
35
        for p in cfg.resp_include:
 
36
                if re.search(p, resp, re.M | re.I)==None:
 
37
                        dlg.hangup(code)
 
38
                        raise TestError("Pattern " + p + " not found")
 
39
        # Check for patterns that must not exist
 
40
        for p in cfg.resp_exclude:
 
41
                if re.search(p, resp, re.M | re.I)!=None:
 
42
                        dlg.hangup(code)
 
43
                        raise TestError("Excluded pattern " + p + " found")
 
44
        pjsua.sync_stdout()
 
45
        dlg.hangup(code)
 
46
        pjsua.sync_stdout()
 
47
 
 
48
# Here where it all comes together
 
49
test = TestParam(cfg_file.sendto_cfg.name, 
 
50
                 [cfg_file.sendto_cfg.inst_param], 
 
51
                 test_func)
 
52
 
 
53