示例#1
0
    def test_validate_dissociation(
        self, user_dao_get, line_dao_get, user_line_dao_find_all_by_user_id, line_has_secondary_user, validate_no_device
    ):
        user_line = UserLine(user_id=3, line_id=4, main_user=True)

        user_line_dao_find_all_by_user_id.return_value = [user_line]
        line_has_secondary_user.return_value = False

        validator.validate_dissociation(user_line)
        user_dao_get.assert_called_once_with(user_line.user_id)
        line_dao_get.assert_called_once_with(user_line.line_id)
        user_line_dao_find_all_by_user_id.assert_called_once_with(user_line.user_id)
        line_has_secondary_user.assert_called_once_with(user_line)
        validate_no_device.assert_called_once_with(user_line.line_id)
示例#2
0
def dissociate(user_line):
    validator.validate_dissociation(user_line)
    ule_service.dissociate_user_line(user_line)
    notifier.dissociated(user_line)