def test_get_cid_for_sip_channel(self): channel = 'SIP/abcd-12445' self.assertRaises(LookupError, user_line_dao._get_cid_for_sip_channel, channel) line = UserSIP() line.name = 'abcd' line.type = 'friend' line.callerid = '"Tester One" <1234>' line.category = 'user' self.add_me(line) result = user_line_dao._get_cid_for_sip_channel(channel) expected = (line.callerid, 'Tester One', '1234') self.assertEqual(result, expected) self.assertRaises(ValueError, user_line_dao._get_cid_for_sip_channel, 'sccp/1300@SEP29287324-1')
def test_find_by_proto_name_sip(self): trunk_name = 'my_trunk' trunk = TrunkFeatures() trunk.protocolid = 5436 trunk.protocol = 'sip' usersip = UserSIP() usersip.id = trunk.protocolid usersip.name = trunk_name usersip.type = 'peer' usersip.category = 'user' self.session.begin() map(self.session.add, [trunk, usersip]) self.session.commit() result = trunk_dao.find_by_proto_name('sip', trunk_name) self.assertEqual(result, trunk.id)
def test_get_cid_for_sip_channel(self): channel = 'SIP/abcd-12445' self.assertRaises(LookupError, user_line_dao._get_cid_for_sip_channel, channel) line = UserSIP() line.name = 'abcd' line.type = 'friend' line.callerid = '"Tester One" <1234>' line.category = 'user' self.session.begin() self.session.add(line) self.session.commit() result = user_line_dao._get_cid_for_sip_channel(channel) expected = (line.callerid, 'Tester One', '1234') self.assertEqual(result, expected) self.assertRaises(ValueError, user_line_dao._get_cid_for_sip_channel, 'sccp/1300@SEP29287324-1')