• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python models.Conference类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_createSession

 def test_createSession(self):
     test_url = '/conference/{wcksafe}/session'
     # Ensure default profile is created
     url = '/profile'
     res = urlfetch.fetch(self.urlbase + url, method='GET')
     self.assertEqual(res.status_code, 200)
     # Create conference and get websafe key
     conf = Conference(
         name='Test Conference',
         organizerUserId=json.loads(res.content)['mainEmail']
     )
     wck = conf.put()
     sleep(0.1)
     wcksafe = wck.urlsafe()
     test_url = test_url.format(wcksafe=wcksafe)
     # Ensure no sessions exist yet
     self.assertEqual(0, len(Session.query().fetch(5)))
     # Test endpoint
     params = {
         'name': 'TEST Session',
         'date': '2015-8-10',
         'startTime': '9:10',
         'conferenceKey': wcksafe
     }
     response = urlfetch.fetch(self.urlbase + test_url,
                     payload=json.dumps(params),
                     method=urlfetch.POST,
                     headers={'Content-Type': 'application/json'})
     self.assertEqual(response.status_code, 200)
开发者ID:Ripley6811,项目名称:FSND-P4-Conference-Organization-App,代码行数:29,代码来源:test_endpoints.py


示例2: test_getSessionsBySpeaker

 def test_getSessionsBySpeaker(self):
     # Create two conferences
     conf = Conference(name='Test Conference A')
     wckA = conf.put()
     wckAsafe = wckA.urlsafe()
     conf = Conference(name='Test Conference B')
     wckB = conf.put()
     wckBsafe = wckB.urlsafe()
     # Add 4 sessions among conferences with three having particular speaker
     propsA = {'name': 'Monkey Business', 'date': date(2015,8,8),
               'parent': wckA, 'conferenceKey': wckAsafe,
               'typeOfSession': 'lecture', 'startTime': time(18,15)}
     propsB = {'name': 'Monkey Business', 'date': date(2015,9,12),
               'parent': wckB, 'conferenceKey': wckBsafe,
               'typeOfSession': 'workshop', 'startTime': time(12,15)}
     # Add two to first created conference
     Session(speaker=['Sarah', 'Frodo'], **propsA).put()
     Session(speaker=['Frodo'], **propsA).put()
     # Add two to second created conference
     Session(speaker=['Saruman'], **propsB).put()
     Session(speaker=['Gollum', 'Frodo'], **propsB).put()
     # Test the endpoint
     url = '/speaker/{0}'.format('Frodo')
     res = urlfetch.fetch(self.urlbase + url)
     self.assertEqual(res.status_code, 200)
     self.assertEqual(len(json.loads(res.content)['items']), 3)
开发者ID:Ripley6811,项目名称:FSND-P4-Conference-Organization-App,代码行数:26,代码来源:test_endpoints.py


示例3: getMarketableConferences

    def getMarketableConferences(self, request):
        """Find the conferences that is in progress and not yet fully booked"""
        mtoday = datetime.now().date()
        # Get conferences with seats available
        conf_inprogress_seatsavail = set(
            Conference.query().filter(
                Conference.seatsAvailable > 0).fetch(keys_only=True))
        # Get conferences where open end date is more or equal than today
        conf_inprogress_enddate = set(
            Conference.query().filter(Conference.endDate >= mtoday).fetch(
                keys_only=True))
        # Get conferences where open start date is less than or equal to today
        conf_inprogress_startdate = set(
            Conference.query().filter(Conference.startDate <= mtoday).fetch(
                keys_only=True))

        # return a set with conferences common in all queries
        conf_inprogress_keys = conf_inprogress_seatsavail\
                               & conf_inprogress_startdate\
                               & conf_inprogress_enddate
        conf_inprogress = ndb.get_multi(conf_inprogress_keys)

        return MarketableConferenceForms(items=[
            MarketableConferenceForm(name=getattr(data, "name"),
                                     topics=getattr(data, "topics"),
                                     city=getattr(data, "city"),
                                     seatsAvailable=getattr(data,
                                                            "seatsAvailable"),
                                     endDate=str(getattr(data, "endDate")))
            for data in conf_inprogress])
开发者ID:acivux,项目名称:ConferenceCentral,代码行数:30,代码来源:conference.py


示例4: match_or_send_to_waiting_room

def match_or_send_to_waiting_room(call, schedule):

    # Refreshing database object
    flush_transaction()
    call.reload()

    if call.matched:
        other = call.conference.call_set.exclude(pk=call.pk)[0]
        data = send_to_conference_room(call, schedule, other, initial=False)

        if data: return data


    matchcall = find_match(schedule, call)
    if matchcall:
        conf = Conference()
        conf.maxcapacity = 2
        conf.datecreated = as_date(schedule)
        conf.save()

        call.conference = conf
        call.matched = True
        call.save()

        matchcall.conference = conf
        matchcall.matched = True
        matchcall.save()

        data = send_to_conference_room(call, schedule, matchcall, initial=True)
        if data: return data

    if call.user.profile.any_match:
        call.user.profile.any_match = False
        call.user.profile.save()

        return render_to_response("twilioresponse.xml", { 'say' :"We are very sorry - We could not find you a match today, but tomorrow we'll do our best to compensate it! We wish you an awesome day!",
                                                          'hangup' : True })
    #Check if we have exceeded the waiting redirect limits
    elif call.retries >= REDIRECT_LIMIT:
        # The user has reached the limit of redials, so hang up
        logger.debug("LIMIT RETRIES - Ask to try to match with any person")
        any_match = "We could not find any matches. If you'd like us to try to match you with Anyone please press any number now."
        goodbye = "We wish you an Amazing day! Good bye!"
        return render_to_response("twilioresponse.xml", { 'any_match' :any_match, 'schedule': schedule, 'hangup': True, 'goodbye' : goodbye })

    call.retries = call.retries + 1
    call.save()

    # Send user to private conference (Conferencename=Username) or send them to the waiting room they were at
    return send_to_waiting_room(  HOLD_LIMIT
                                    , schedule
                                    , call.user.username
                                    , False
                                    , "Please bare with us - we'll find the best match for you!")
开发者ID:axsauze,项目名称:wakeuproulette,代码行数:54,代码来源:views.py


示例5: _createConferenceObject

    def _createConferenceObject(self, conferenceForm):
        """Create conference object, returns ConferenceForm."""

        user = endpoints.get_current_user()
        if not user:
            raise endpoints.UnauthorizedException('Authorization required')

        data = formToDict(conferenceForm, exclude=('websafeKey', 'organizerDisplayName'))
        # add default values for those missing
        for df in DEFAULTS:
            if data[df] in (None, []):
                data[df] = DEFAULTS[df]

        # add organizerUserId before checking the required fields
        data['organizerUserId'] = user_id = getUserId(user)

        # check required fields
        for key in Conference.required_fields_schema:
            if not data[key]:
                raise endpoints.BadRequestException("Conference '%s' field required" % key)

        # convert dates from strings to Date objects; set month based on start_date
        try:
            data['startDate'] = datetime.strptime(data['startDate'][:10], "%Y-%m-%d").date()
            data['endDate'] = datetime.strptime(data['endDate'][:10], "%Y-%m-%d").date()
        except (TypeError, ValueError):
            raise endpoints.BadRequestException("Invalid date format. Please use 'YYYY-MM-DD'")

        if data['startDate'] > data['endDate']:
            raise endpoints.BadRequestException("start date must be before end date")
        data['month'] = data['startDate'].month

        # set seatsAvailable to be same as maxAttendees on creation
        if data["maxAttendees"] > 0:
            data["seatsAvailable"] = data["maxAttendees"]

        # generate Profile Key based on user ID and Conference
        # ID based on Profile key get Conference key from ID
        p_key = ndb.Key(Profile, user_id)
        c_id = Conference.allocate_ids(size=1, parent=p_key)[0]
        c_key = ndb.Key(Conference, c_id, parent=p_key)
        data['key'] = c_key

        # create Conference, send email to organizer confirming
        # creation of Conference & return (modified) ConferenceForm
        conf = Conference(**data)
        conf.put()
        taskqueue.add(
            params={'email': user.email(), 'conferenceInfo': repr(conferenceForm)},
            url='/tasks/send_confirmation_email'
        )
        return conf.toForm()
开发者ID:LuizGsa21,项目名称:p4-conference-central,代码行数:52,代码来源:conference.py


示例6: get

    def get(self, conf_handle = None):
	request = self.wsgi_request
	response = self.wsgi_response
	c = self.context

	if conf_handle:
	    conf_id = Conference.get_id_from_url_title(conf_handle)
	    c.conf = Conference.get(conf_id)
	    if c.conf:
		return self.render_stuff('/index.html')	
	
	self.set_body("Please enter a valid conference handle..")
	return self.render()
开发者ID:droot,项目名称:Batty,代码行数:13,代码来源:handlers.py


示例7: _createConferenceObject

    def _createConferenceObject(self, request):
        """Create or update Conference object, returning ConferenceForm/request."""
        # preload necessary data items
        user = endpoints.get_current_user()
        if not user:
            raise endpoints.UnauthorizedException('Authorization required')
        user_id = getUserId(user)

        if not request.name:
            raise endpoints.BadRequestException("Conference 'name' field required")

        # copy ConferenceForm/ProtoRPC Message into dict
        data = {field.name: getattr(request, field.name) for field in request.all_fields()}
        del data['websafeKey']
        del data['organizerDisplayName']

        # add default values for those missing (both data model & outbound Message)
        for df in DEFAULTS:
            if data[df] in (None, []):
                data[df] = DEFAULTS[df]
                setattr(request, df, DEFAULTS[df])

        # convert dates from strings to Date objects; set month based on start_date
        if data['startDate']:
            data['startDate'] = datetime.strptime(data['startDate'][:10], "%Y-%m-%d").date()
            data['month'] = data['startDate'].month
        else:
            data['month'] = 0
        if data['endDate']:
            data['endDate'] = datetime.strptime(data['endDate'][:10], "%Y-%m-%d").date()

        # set seatsAvailable to be same as maxAttendees on creation
        # both for data model & outbound Message
        if data["maxAttendees"] > 0:
            data["seatsAvailable"] = data["maxAttendees"]
            setattr(request, "seatsAvailable", data["maxAttendees"])

        # make Profile Key from user ID
        p_key = ndb.Key(Profile, user_id)
        # allocate new Conference ID with Profile key as parent
        c_id = Conference.allocate_ids(size=1, parent=p_key)[0]
        # make Conference key from ID
        c_key = ndb.Key(Conference, c_id, parent=p_key)
        data['key'] = c_key
        data['organizerUserId'] = request.organizerUserId = user_id

        # create Conference & return (modified) ConferenceForm
        conference = Conference(**data)
        conference.put()

        return request
开发者ID:Nasafato,项目名称:LearningCloudEndpoints,代码行数:51,代码来源:conference.py


示例8: getConferencesNotSoldOutInAmsterdam

    def getConferencesNotSoldOutInAmsterdam(self, request):
        """ Only show conferences in Amsterdam that are not sold out
        """
        in_amsterdam = Conference.query(
            Conference.city == 'Amsterdam')
        not_sold_out = Conference.query(
            Conference.seatsAvailable > 0)

        confs = self._intersectQueries(in_amsterdam, not_sold_out)
        names = self._getConferenceOrganisers(confs)

        return ConferenceForms(
            items=[self._copyConferenceToForm(
                conf, names[conf.organizerUserId]) for conf in confs])
开发者ID:adarsh0806,项目名称:udacity-nd004-p4-conference-organization-app,代码行数:14,代码来源:conference.py


示例9: _createSessionObject

    def _createSessionObject(self, request):
        """Create or update Session object, returning SessionForm/request."""
        user = endpoints.get_current_user()
        if not user:
            raise endpoints.UnauthorizedException('Authorization required')
        user_id = getUserId(user)

        if not request.name:
            raise endpoints.BadRequestException("Session 'name' field required")

        # copy SessionForm/ProtoRPC Message into dict
        data = {field.name: getattr(request, field.name) for field in request.all_fields()}
        del data['websafeKey']
        # del data['organizerDisplayName']

        # add default values for those missing (both data model & outbound Message)
        for df in DEFAULTS_SESSION:
            if data[df] in (None, []):
                data[df] = DEFAULTS_SESSION[df]
                setattr(request, df, DEFAULTS_SESSION[df])

        # Getting a TEMP conference key for the moment
        q = Conference.query()
        cons = q.get()
        c_key = cons.key
        s_id = Session.allocate_ids(size=1, parent=c_key)[0]
        s_key = ndb.Key(Session, s_id, parent=c_key)
        data['key'] = s_key

        Session(**data).put()

        return request
开发者ID:dchilders21,项目名称:Udacity_P4_ConferenceCentral,代码行数:32,代码来源:conference.py


示例10: getConferencesByPopularity

    def getConferencesByPopularity(self, request):
        """Return conferences by popularity"""
        # fetch conference from key
        conf = Conference.query().fetch()

        # Check that conference exists
        if not conf:
            raise endpoints.NotFoundException("No conference found with this key: %s" % request.websafeConferenceKey)
        conf_list = []

        for c in conf:
            count = Profile.query().filter(Profile.conferenceKeysToAttend == c.key.urlsafe()).count()
            conf_list.append({"conf": c, "count": count})
        conf_list = sorted(conf_list, key=lambda conf: conf["count"], reverse=True)

        # need to fetch organiser displayName from profiles
        # get all keys and use get_multi for speed
        organisers = [(ndb.Key(Profile, c.organizerUserId)) for c in conf]
        profiles = ndb.get_multi(organisers)

        # put display names in a dict for easier fetching
        names = {}
        for profile in profiles:
            names[profile.key.id()] = profile.displayName

        # return individual ConferenceForm object per Conference
        return ConferenceForms(
            items=[self._copyConferenceToForm(c["conf"], names[c["conf"].organizerUserId]) for c in conf_list]
        )
开发者ID:jdvalera,项目名称:Udacity-Full-Stack,代码行数:29,代码来源:conference.py


示例11: get

 def get(self, confid, secret):
     """Download all speakers and proposals for a conference"""
     # Super-Reviewers
     committee = []
     if confid == 'droidcon-2016':
         committee = ['[email protected]',
                      '[email protected]']
     # get conference
     conference = Conference.get_by_id(confid)
     # check if the provided secret is correct
     if conference.secret != secret:
         self.response.http_status_message(403)
         return
     speakers = Speaker.query()
     proposals = Proposal.query(ancestor=conference.key)
     reviews = Review.query()
     speakers_dict = [dict(s.to_dict(), **dict(id=s.key.id()))
                      for s in speakers]
     proposals_dict = []
     # create a fast lookup table - reviews by parent
     reviews_by_parent = {}
     for r in reviews:
         parent = r.key.parent()
         rlist = reviews_by_parent[parent]
         if rlist is None:
             rlist = []
         rlist.append(r)
         reviews_by_parent[parent] = rlist
     # crete a fast lookup table - speaker by key
     speakers_by_id = {}
     for s in speakers:
         speakers_by_key[s.key] = s
     for p in proposals:
         p_dict = p.to_dict()
         p_dict['id'] = p.key.id()
         p_r = {}
         p_sum = 0
         for r in reviews_by_parent[p.key]:
             p_r[r.key.id()] = r.to_dict()
             if r.rating:
                 if r.key.id() in committee:
                     # double the rating!
                     p_sum = p_sum + r.rating
                 p_sum = p_sum + r.rating
         s = speakers_by_key[p.speaker]
         if s is not None:
             p_dict['speaker-email'] = s.email
             p_dict['speaker-name'] = s.name
             p_dict['speaker-surname'] = s.surname
             if s.rating:
                 p_sum = p_sum + s.rating
         p_dict['reviews'] = p_r
         p_dict['rating'] = p_sum
         proposals_dict.append(p_dict)
     self.response.headers['Content-Type'] = 'application/json'
     obj = {
         'speakers': speakers_dict,
         'proposals': proposals_dict,
     }
     self.response.out.write(json.dumps(obj, cls=DatastoreEncoder))
开发者ID:GDGVienna,项目名称:cfp-manager,代码行数:60,代码来源:backup.py


示例12: getSessionsBySpeaker

    def getSessionsBySpeaker(self, request):
        """Given a speaker, return all sessions given by this particular speaker, across all conferences"""

        # make sure user is logged in
        user = endpoints.get_current_user()
        if not user:
            raise endpoints.UnauthorizedException("Authorization required")
        user_id = getUserId(user)

        # get speaker value from form request
        sessionSpeakerOfInterest = request.speaker

        # store all session objects across all conferences where this speaker is presenting
        all_sessions = []
        # query for conferences
        conferences = Conference.query()
        for conf in conferences:
            ck = getattr(conf, "key")
            wsck = ck.urlsafe()

            # For each conference, get Sessions for the Conference filtered by Speaker
            sessions = Session.query(Session.websafeConferenceKey == wsck)
            sessions = sessions.filter(Session.speaker == sessionSpeakerOfInterest)

            for session in sessions:
                all_sessions.append(session)

        # return sessions in all conferences
        return SessionForms(items=[self._copySessionToForm(session) for session in all_sessions])
开发者ID:twhetzel,项目名称:ud858-scalable-apps,代码行数:29,代码来源:conference.py


示例13: _createConferenceObject

 def _createConferenceObject(self, request):
     """Create or update Conference object, returning ConferenceForm/request."""
     user = endpoints.get_current_user()
     if not user:
         raise endpoints.UnauthorizedException('Authorization required')
     user_id = getUserId(user)
     if not request.name:
         raise endpoints.BadRequestException("Conference 'name' field required")
     data = {field.name: getattr(request, field.name) for field in request.all_fields()}
     del data['websafeKey']
     del data['organizerDisplayName']
     for df in DEFAULTS:
         if data[df] in (None, []):
             data[df] = DEFAULTS[df]
             setattr(request, df, DEFAULTS[df])
     if data['startDate']:
         data['startDate'] = datetime.strptime(data['startDate'][:10], "%Y-%m-%d").date()
         data['month'] = data['startDate'].month
     else:
         data['month'] = 0
     if data['endDate']:
         data['endDate'] = datetime.strptime(data['endDate'][:10], "%Y-%m-%d").date()
     if data["maxAttendees"] > 0:
         data["seatsAvailable"] = data["maxAttendees"]
     p_key = ndb.Key(Profile, user_id)
     c_id = Conference.allocate_ids(size=1, parent=p_key)[0]
     c_key = ndb.Key(Conference, c_id, parent=p_key)
     data['key'] = c_key
     data['organizerUserId'] = request.organizerUserId = user_id
     Conference(**data).put()
     taskqueue.add(params={'email': user.email(),
         'conferenceInfo': repr(request)},
         url='/tasks/send_confirmation_email'
     )
     return request
开发者ID:Taiyi,项目名称:Conference,代码行数:35,代码来源:conference.py


示例14: getSessionsByDateAndCity

    def getSessionsByDateAndCity(self, request):
        """Return all sessions in given city on given date."""
        # Expect date in format YYYY-MM-DD
        try:
            date = datetime.strptime(request.date, '%Y-%m-%d').date()
        except ValueError:
            raise endpoints.BadRequestException('Invalid date - '
                        'must be in YYYY-MM-DD format')

        # get just the keys for conferences in city
        conf_keys = Conference.query(Conference.city==request.city)\
                              .fetch(keys_only=True)

        # get all sessions for conferences in city, filter on date
        # (Guido's advice in http://stackoverflow.com/questions/12440333/
        # ndb-query-on-multiple-parents-given-a-cursor)
        # need to do multiple ancestor queries, do asynchronously
        futures = []
        for c_key in conf_keys:
            futures.append(Session.query(ancestor=c_key)\
                   .filter(Session.date==date)\
                   .fetch_async())
        
        sess = []
        for f in futures:
            sess.extend(f.get_result())
        
        return SessionForms(
            items=[self._copySessionToForm(s) for s in sess]
        )
开发者ID:mkmadd,项目名称:ud858,代码行数:30,代码来源:conference.py


示例15: filterPlayground

    def filterPlayground(self, request):
        q = Conference.query()

        # advanced filter building and usage
        field = "city"
        operator = "="
        value = "London"
        f = ndb.query.FilterNode(field, operator, value)
        q = q.filter(f)

        # TODO
        # add 2 filters:
        # 1: city equals to London
        # 2: topic equals "Medical Innovations"

        field = "topics"
        operation = "="
        value = "Medical Innovations"
        f = ndb.query.FilterNode(field, operator, value)
        q = q.filter(f)

        q = q.order(Conference.maxAttendees)

        return ConferenceForms(
            items=[self._copyConferenceToForm(conf, "") for conf in q]
        )
开发者ID:silveruby,项目名称:udacity-full-stack-p4,代码行数:26,代码来源:conference.py


示例16: filterPlayground

    def filterPlayground(self, request):
        q = Conference.query()
        # simple filter usage:
        # q = q.filter(Conference.city == "San Francisco")

        # advanced filter building and usage
        field = "city"
        operator = "="
        value = "London"
        field2 = "topics"
        operator2 = "="
        value2 = "Medical Innovations"
        f = ndb.query.FilterNode(field, operator, value)
        g = ndb.query.FilterNode(field2, operator2, value2)
        q = q.filter(f)
        q = q.filter(g)
        q = q.order(Conference.name)
        q = q.filter(Conference.maxAttendees > 30)
        #r = q.filter(g)

        # TODO
        # add 2 filters:
        # 1: city equals to London
        # 2: topic equals "Medical Innovations"

        return ConferenceForms(
            items=[self._copyConferenceToForm(conf, "") for conf in q]
        )
开发者ID:erooma,项目名称:ud858,代码行数:28,代码来源:conference.py


示例17: queryConferences

    def queryConferences(self, request):
        """Queries conferences for results."""
        conferences = Conference.query()

        return ConferenceForms(
            items = [self._copyConferenceToForm(conf, "")\
            for conf in conferences])
开发者ID:iamparas,项目名称:Conference-Centre,代码行数:7,代码来源:conference.py


示例18: getNotRegisteredWishlist

    def getNotRegisteredWishlist(self, request):
        """Returns all sesssions on a users wishlist where the user is not
        registered for the conference."""
        prof = self._getProfileFromUser()
        wishlist = prof.wishList
        wishlist_keys = [ndb.Key(urlsafe=wish) for wish in wishlist]

        # Get conferences attending.
        attending_wsk = prof.conferenceKeysToAttend
        attending_keys = [ndb.Key(urlsafe=wsk) for wsk in attending_wsk]

        # Get the parent conferenes of all sessions in the query.
        conf_keys = [session_key.parent() for session_key in wishlist_keys]

        # Query confreences with wishlist session as child.
        q = Conference.query()
        q = q.filter(Conference.key.IN([key for key in conf_keys]))

        # Query conferences that do not include those being attended.
        for key in attending_keys:
            q = q.filter(Conference.key != key)

        return ConferenceForms(
            items=[self._copyConferenceToForm(conference, "")
                for conference in q])
开发者ID:mwhitmore1,项目名称:Udacity-Project-4,代码行数:25,代码来源:conference.py


示例19: filterPlayground

    def filterPlayground(self, request):
        """Return conferences based on query."""

        # define query
        conferences = Conference.query()
        
        # filter by city
        field = "city"
        operator = "="
        value = "London"
        f = ndb.FilterNode(field, operator, value)
        conferences = conferences.filter(f)

        # add another filter, by topic
        field = "topics"
        operator = "="
        value = "Medical Innovations"
        f = ndb.FilterNode(field, operator, value)
        conferences = conferences.filter(f)

        # and filter by month
        conferences = conferences.filter(Conference.maxAttendees > 10)

        # order by conference name
        conferences = conferences.order(Conference.name)

        # return set of ConferenceForm objects per Conference
        return ConferenceForms(
            items=[self._copyConferenceToForm(conf, "") for conf in conferences]
        )
开发者ID:mmitre,项目名称:conf-central,代码行数:30,代码来源:conference.py


示例20: testUnregisterFromConference

    def testUnregisterFromConference(self):
        """ TEST: Unregister user for selected conference."""
        self.initDatabase()

        # verify database fixture
        self.login()
        prof = ndb.Key(Profile, self.getUserId()).get()
        conf = Conference.query(Conference.name == 'room #2').get()
        assert conf and conf.seatsAvailable == 1 and len(prof.conferenceKeysToAttend) == 0, \
            "This shouldn't fail. Maybe someone messed with database fixture"

        prof.conferenceKeysToAttend.append(conf.key)
        prof.put()

        container = CONF_GET_REQUEST.combined_message_class(
            websafeConferenceKey=conf.key.urlsafe(),
        )

        # unregister conference
        r = self.api.unregisterFromConference(container)

        # re-fetch profile and conference, then check if user was properly unregistered
        prof = prof.key.get()
        conf = conf.key.get()
        assert r.data, 'Returned an invalid response'
        assert len(prof.conferenceKeysToAttend) == 0, "Failed to remove conference from user's conferenceKeysToAttend"
        assert conf.seatsAvailable == 2, 'Failed to increment available seats'
开发者ID:LuizGsa21,项目名称:p4-conference-central,代码行数:27,代码来源:test_conference.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python models.ConferenceForm类代码示例发布时间:2022-05-27
下一篇:
Python models.Company类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap