def test_get_user_config_with_no_line(self): user = self.add_user() result = user_dao.get_user_config(user.id) assert_that(result[str(user.id)]["context"], none()) assert_that(result[str(user.id)]["linelist"], equal_to([]))
def test_get_user_config_with_no_line(self): user = self.add_user() result = user_dao.get_user_config(user.id) assert_that(result[str(user.id)]['context'], none()) assert_that(result[str(user.id)]['linelist'], equal_to([]))
def test_get_user_config(self): firstname = u"Jack" lastname = u"Strap" fullname = u"%s %s" % (firstname, lastname) callerid = u'"%s"' % fullname context = u"mycontext" user_line = self.add_user_line_with_exten( firstname=firstname, lastname=lastname, context=context, exten="1234", name="12kjdhf", provisioningid=1234, protocolid=1, musiconhold=u"", ) user_id = user_line.user.id line_list = [str(user_line.line.id)] expected = { str(user_id): { "agentid": None, "bsfilter": "no", "callerid": callerid, "callrecord": 0, "commented": 0, "context": context, "cti_profile_id": None, "description": "", "destbusy": u"", "destrna": u"", "destunc": u"", "enableautomon": 0, "enablebusy": 0, "enableclient": 0, "enablednd": 0, "enablehint": 1, "enablerna": 0, "enableunc": 0, "enablevoicemail": 0, "enablexfer": 1, "entityid": None, "firstname": firstname, "fullname": fullname, "id": user_id, "identity": fullname, "incallfilter": 0, "language": None, "lastname": lastname, "linelist": line_list, "loginclient": u"", "mobilephonenumber": u"", "musiconhold": u"", "outcallerid": u"", "passwdclient": u"", "pictureid": None, "preprocess_subroutine": None, "rightcallcode": None, "ringextern": None, "ringforward": None, "ringgroup": None, "ringintern": None, "ringseconds": 30, "simultcalls": 5, "timezone": None, "userfield": u"", "voicemailid": None, "voicemailtype": None, } } result = user_dao.get_user_config(user_id) result_dict = result[str(user_id)] expected_dict = expected[str(user_id)] for key, expected_value in expected_dict.iteritems(): result_value = result_dict[key] assert_that(expected_value, equal_to(result_value), "key %r does not match" % key) assert_that(result, equal_to(expected))
def _get_user(self, user_id): return user_dao.get_user_config(user_id)
def test_get_user_config(self): firstname = u'Jack' lastname = u'Strap' fullname = u'%s %s' % (firstname, lastname) callerid = u'"%s"' % fullname context = u'mycontext' user_line = self.add_user_line_with_exten(firstname=firstname, lastname=lastname, context=context, exten='1234', name='12kjdhf', provisioningid=1234, protocolid=1, musiconhold=u'') user_id = user_line.user.id line_list = [str(user_line.line.id)] expected = { str(user_id): { 'agentid': None, 'bsfilter': 'no', 'callerid': callerid, 'callrecord': 0, 'commented': 0, 'context': context, 'cti_profile_id': None, 'description': '', 'destbusy': u'', 'destrna': u'', 'destunc': u'', 'enableautomon': 0, 'enablebusy': 0, 'enableclient': 0, 'enablednd': 0, 'enablehint': 1, 'enablerna': 0, 'enableunc': 0, 'enablevoicemail': 0, 'enablexfer': 1, 'entityid': None, 'firstname': firstname, 'fullname': fullname, 'id': user_id, 'identity': fullname, 'incallfilter': 0, 'language': None, 'lastname': lastname, 'linelist': line_list, 'loginclient': u'', 'mobilephonenumber': u'', 'musiconhold': u'', 'outcallerid': u'', 'passwdclient': u'', 'pictureid': None, 'preprocess_subroutine': None, 'rightcallcode': None, 'ringextern': None, 'ringforward': None, 'ringgroup': None, 'ringintern': None, 'ringseconds': 30, 'simultcalls': 5, 'timezone': None, 'userfield': u'', 'voicemailid': None, 'voicemailtype': None, } } result = user_dao.get_user_config(user_id) result_dict = result[str(user_id)] expected_dict = expected[str(user_id)] for key, expected_value in expected_dict.iteritems(): result_value = result_dict[key] assert_that(expected_value, equal_to(result_value), 'key %r does not match' % key) assert_that(result, equal_to(expected))