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

Python team.Team类代码示例

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

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



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

示例1: TestTeamMediaApiController

class TestTeamMediaApiController(unittest2.TestCase):
    def setUp(self):
        app = webapp2.WSGIApplication([webapp2.Route(r'/<team_key:>/<year:>', ApiTeamMediaController, methods=['GET'])], debug=True)

        self.testapp = webtest.TestApp(app)

        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_urlfetch_stub()
        self.testbed.init_memcache_stub()
        self.testbed.init_taskqueue_stub(root_path=".")

        self.team = Team(
                id="frc254",
                name="very long name",
                team_number=254,
                nickname="Teh Chezy Pofs",
                address="Greenville, SC, USA"
        )
        self.team.put()

        self.cdmedia = Media(
                        key=ndb.Key('Media', 'cdphotothread_39894'),
                        details_json=u'{"image_partial": "fe3/fe38d320428adf4f51ac969efb3db32c_l.jpg"}',
                        foreign_key=u'39894',
                        media_type_enum=1,
                        references=[ndb.Key('Team', 'frc254')],
                        year=2014)
        self.cdmedia.put()
        self.cddetails = dict()
        self.cddetails["image_partial"] = "fe3/fe38d320428adf4f51ac969efb3db32c_l.jpg"

        self.ytmedia = Media(
                        key=ndb.Key('Media', 'youtube_aFZy8iibMD0'),
                        details_json=None,
                        foreign_key=u'aFZy8iibMD0',
                        media_type_enum=0,
                        references=[ndb.Key('Team', 'frc254')],
                        year=2014)
        self.ytmedia.put()

    def tearDown(self):
        self.testbed.deactivate()

    def testTeamMediaApi(self):
        response = self.testapp.get('/frc254/2014', headers={"X-TBA-App-Id": "tba-tests:team_media-controller-test:v01"})
        media = json.loads(response.body)

        self.assertEqual(len(media), 2)

        cd = media[0]
        self.assertEqual(cd["type"], "cdphotothread")
        self.assertEqual(cd["foreign_key"], "39894")
        self.assertEqual(cd["details"], self.cddetails)

        yt = media[1]
        self.assertEqual(yt["type"], "youtube")
        self.assertEqual(yt["foreign_key"], "aFZy8iibMD0")
        self.assertEqual(yt["details"], {})
开发者ID:DNGros,项目名称:the-blue-alliance,代码行数:60,代码来源:test_apiv2_team_controller.py


示例2: _upload_stats

def _upload_stats(team_name, stats):
    query = Team.all()
    query.filter('name =', team_name)
    result = query.fetch(1)

    if len(result) > 0:
        for team in result:
            team.year = Const.LAST_YEAR
            team.offense_passing = stats['offense']['pass']
            team.offense_rushing = stats['offense']['rush']
            team.offense_first_down = stats['offense']['first_down']
            team.defense_passing = stats['defense']['pass']
            team.defense_rushing = stats['defense']['rush']
            team.defense_first_down = stats['defense']['first_down']

            team.put()
    else:
        team = Team(name = team_name,
                    year = Const.LAST_YEAR,
                    offense_passing = stats['offense']['pass'],
                    offense_rushing = stats['offense']['rush'],
                    offense_first_down = stats['offense']['first_down'],
                    defense_passing = stats['defense']['pass'],
                    defense_rushing = stats['defense']['rush'],
                    defense_first_down = stats['defense']['first_down'])

        team.put()
开发者ID:FenrirUnbound,项目名称:StatsUp,代码行数:27,代码来源:create_eleven.py


示例3: get

    def get(self, page_num=0):
        self._require_admin()
        page_num = int(page_num)

        if page_num < self.MAX_PAGE:
            start = self.PAGE_SIZE * page_num
            end = start + self.PAGE_SIZE
            teams = Team.query(Team.team_number >= start, Team.team_number < end).order(Team.team_number).fetch()
        else:
            start = self.PAGE_SIZE * self.MAX_PAGE
            teams = Team.query(Team.team_number >= start).order(Team.team_number).fetch()

        page_labels = []
        for page in xrange(self.MAX_PAGE):
            if page == 0:
                page_labels.append('1-999')
            else:
                page_labels.append('{}\'s'.format(1000 * page))
        page_labels.append('{}+'.format(1000 * self.MAX_PAGE))

        self.template_values.update({
            "teams": teams,
            "num_teams": Team.query().count(),
            "page_num": page_num,
            "page_labels": page_labels,
        })

        path = os.path.join(os.path.dirname(__file__), '../../templates/admin/team_list.html')
        self.response.out.write(template.render(path, self.template_values))
开发者ID:MC42,项目名称:the-blue-alliance,代码行数:29,代码来源:admin_team_controller.py


示例4: setUp

    def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_memcache_stub()

        event = Event(
            id="2011ct",
            end_date=datetime.datetime(2011, 4, 2, 0, 0),
            event_short="ct",
            event_type_enum=EventType.REGIONAL,
            first_eid="5561",
            name="Northeast Utilities FIRST Connecticut Regional",
            start_date=datetime.datetime(2011, 3, 31, 0, 0),
            year=2011,
            venue_address="Connecticut Convention Center\r\n100 Columbus Blvd\r\nHartford, CT 06103\r\nUSA",
            website="http://www.ctfirst.org/ctr"
        )
        event.put()

        team = Team(
            id="frc177",
            team_number=177,
            website="http://www.bobcatrobotics.org"
        )
        team.put()

        event_team = EventTeam(
            id="%s_%s" % (event.key.id(), team.key.id()),
            event=event.key,
            team=team.key,
            year=None)
        event_team.put()
开发者ID:BowlesCR,项目名称:the-blue-alliance,代码行数:33,代码来源:test_event_team_repairer.py


示例5: setUp

    def setUp(self):
        app = webapp2.WSGIApplication([webapp2.Route(r'/<page_num:([0-9]*)>', ApiTeamListController, methods=['GET'])], debug=True)
        self.testapp = webtest.TestApp(app)

        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_urlfetch_stub()
        self.testbed.init_memcache_stub()
        self.testbed.init_taskqueue_stub(root_path=".")

        self.team1 = Team(
                id="frc123",
                name="SomeName",
                team_number=123,
                nickname="SomeNickname",
                address="San Jose, CA, USA",
                website="www.website.com",
        )

        self.team2 = Team(
                id="frc4567",
                name="SomeName",
                team_number=4567,
                nickname="SomeNickname",
                address="San Jose, CA, USA",
                website="www.website.com",
        )

        self.team1.put()
        self.team2.put()
开发者ID:DNGros,项目名称:the-blue-alliance,代码行数:31,代码来源:test_apiv2_team_controller.py


示例6: create_client

def create_client(user, params):
    name = params.get("name", "")
    if not name or len(name) > 30:
        return {"error_code":20251, "msg":"name invalid"}

    #team = Team.select().where(Team.user == user, Team.name == name).first()
    team = Team.select().where(Team.user == user).first()
    if team:
        return {"error_code":20252, "msg":"team is exists and must one"}

    team_id = GUID.guid()
    team = Team()
    team.id = team_id
    team.user = user
    team.name = name
    team.status = "normal"
    team.team_type = 'client'
    team.logo = widget.logo()
    team.save(force_insert=True)

    user.to_req = True
    user.identify = "c%s" % team.id
    user.save()

    team_profile = TeamProfile()
    team_profile.team = team
    team_profile.save()

    #Member.create(user=user, team=team, mtype='owner')
    return {"error_code":0, "msg":"ok"}
开发者ID:wdvill,项目名称:cloud_admin,代码行数:30,代码来源:user.py


示例7: get

    def get(self, key_name):
        df = DatafeedUsfirst()
        legacy_df = DatafeedUsfirstLegacy()

        team = df.getTeamDetails(Team.get_by_id(key_name))
        if not team:
            logging.warning("getTeamDetails with DatafeedUsfirst for event id {} failed. Retrying with DatafeedUsfirstLegacy.".format(key_name))
            team = legacy_df.getTeamDetails(Team.get_by_id(key_name))
        else:
            legacy_team = legacy_df.getTeamDetails(Team.get_by_id(key_name))
            if legacy_team is not None:
                team.rookie_year = legacy_team.rookie_year  # only available on legacy df

        if team:
            team = TeamManipulator.createOrUpdate(team)
            success = True
        else:
            success = False

        template_values = {
            'key_name': key_name,
            'team': team,
            'success': success,
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_team_details_get.html')
        self.response.out.write(template.render(path, template_values))
开发者ID:dewdn2,项目名称:the-blue-alliance,代码行数:27,代码来源:datafeed_controller.py


示例8: _render

 def _render(self, *args, **kw):
     team_a = Team.get_by_id(self._team_key_a) if self._team_key_a else None
     team_b = Team.get_by_id(self._team_key_b) if self._team_key_b else None
     self.template_values.update({
         'team_a': team_a,
         'team_b': team_b,
     })
     return jinja2_engine.render('2champs.html', self.template_values)
开发者ID:legoktm,项目名称:the-blue-alliance,代码行数:8,代码来源:main_controller.py


示例9: TestDistrictTeamsApiController

class TestDistrictTeamsApiController(unittest2.TestCase):
    def setUp(self):
        app = webapp2.WSGIApplication(
            [webapp2.Route(r"/<district_abbrev:>/<year:([0-9]*)>", ApiDistrictTeamsController, methods=["GET"])],
            debug=True,
        )
        self.testapp = webtest.TestApp(app)

        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_urlfetch_stub()
        self.testbed.init_memcache_stub()
        ndb.get_context().clear_cache()  # Prevent data from leaking between tests

        self.testbed.init_taskqueue_stub(root_path=".")

        self.team = Team(
            id="frc281",
            name="Michelin / Caterpillar / Greenville Technical College /\
                jcpenney / Baldor / ASME / Gastroenterology Associates /\
                Laserflex South & Greenville County Schools & Greenville\
                Technical Charter High School",
            team_number=281,
            nickname="EnTech GreenVillians",
            city="Greenville",
            state_prov="SC",
            country="USA",
            website="www.entech.org",
            motto="Infiltrating Young Minds One Robot at a Time",
        )

        self.district_team = DistrictTeam(id="2015ne_frc281", team=self.team.key, year=2015, district=3)

        self.team.put()
        self.district_team.put()

    def tearDown(self):
        self.testbed.deactivate()

    def assertTeamJson(self, team):
        team = team[0]
        self.assertEqual(team["key"], self.team.key_name)
        self.assertEqual(team["team_number"], self.team.team_number)
        self.assertEqual(team["nickname"], self.team.nickname)
        self.assertEqual(team["location"], self.team.location)
        self.assertEqual(team["locality"], "Greenville")
        self.assertEqual(team["country_name"], "USA")
        self.assertEqual(team["region"], "SC")
        self.assertEqual(team["website"], self.team.website)
        self.assertEqual(team["motto"], self.team.motto)

    def testDistrictsApi(self):
        response = self.testapp.get(
            "/ne/2015", headers={"X-TBA-App-Id": "tba-tests:team-districts-controller-test:v01"}
        )
        teams = json.loads(response.body)
        self.assertTeamJson(teams)
开发者ID:the-blue-alliance,项目名称:the-blue-alliance,代码行数:58,代码来源:test_apiv2_team_controller.py


示例10: TestTeamListApiController

class TestTeamListApiController(unittest2.TestCase):
    def setUp(self):
        app = webapp2.WSGIApplication([webapp2.Route(r'/<page_num:([0-9]*)>', ApiTeamListController, methods=['GET'])], debug=True)
        self.testapp = webtest.TestApp(app)

        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_urlfetch_stub()
        self.testbed.init_memcache_stub()
        self.testbed.init_taskqueue_stub(root_path=".")

        self.team1 = Team(
                id="frc123",
                name="SomeName",
                team_number=123,
                nickname="SomeNickname",
                address="San Jose, CA, USA",
                website="www.website.com",
        )

        self.team2 = Team(
                id="frc4567",
                name="SomeName",
                team_number=4567,
                nickname="SomeNickname",
                address="San Jose, CA, USA",
                website="www.website.com",
        )

        self.team1.put()
        self.team2.put()

    def tearDown(self):
        self.testbed.deactivate()

    def assertTeam1Json(self, team):
        self.assertEqual(team["key"], self.team1.key_name)
        self.assertEqual(team["name"], self.team1.name)
        self.assertEqual(team["team_number"], self.team1.team_number)

    def assertTeam2Json(self, team):
        self.assertEqual(team["key"], self.team2.key_name)
        self.assertEqual(team["name"], self.team2.name)
        self.assertEqual(team["team_number"], self.team2.team_number)

    def testTeamListApi(self):
        response = self.testapp.get('/0', headers={"X-TBA-App-Id": "tba-tests:team_list-controller-test:v01"})
        team_list = json.loads(response.body)
        self.assertTeam1Json(team_list[0])

        response = self.testapp.get('/9', headers={"X-TBA-App-Id": "tba-tests:team_list-controller-test:v01"})
        team_list = json.loads(response.body)
        self.assertTeam2Json(team_list[0])

        response = self.testapp.get('/10', headers={"X-TBA-App-Id": "tba-tests:team_list-controller-test:v01"})
        team_list = json.loads(response.body)
        self.assertEqual(team_list, [])
开发者ID:DNGros,项目名称:the-blue-alliance,代码行数:58,代码来源:test_apiv2_team_controller.py


示例11: create_entry_from_params

    def create_entry_from_params(self, params):
        new_team = Team(title = params["title"],
                        description = params["description"],
                        location = params["location"],
                        league = params["league"],
                        ref_id = params["ref_id"])

        new_team.put()
        return new_team
开发者ID:mattrjacobs,项目名称:Prdict,代码行数:9,代码来源:team_svc.py


示例12: TestDatafeedUsfirstLegacyTeams

class TestDatafeedUsfirstLegacyTeams(unittest2.TestCase):
    def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_urlfetch_stub()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_memcache_stub()

        self.datafeed = DatafeedUsfirstLegacy()

        self.team177 = Team(
            id="frc177",
            team_number=177,
            first_tpid=211521,
            first_tpid_year=2014,
        )
        self.team177.put()

    def tearDown(self):
        self.testbed.deactivate()

    def test_getTeamDetails(self):
        team = self.datafeed.getTeamDetails(self.team177)

        self.assertEqual(team.key.id(), 'frc177')
        self.assertEqual(team.name, "United Technologies / ClearEdge Power / Gain Talent / EBA&D & South Windsor High School")
        self.assertEqual(team.address, u"South Windsor, CT\xa0 USA")
        self.assertEqual(team.nickname, "Bobcat Robotics")
        self.assertEqual(team.rookie_year, 1995)
        self.assertEqual(team.website, "http://www.bobcatrobotics.org")

    def test_getTeamsTpids(self):
        Team(
          id="frc4409",
          team_number=4409,
          first_tpid=0,  # should be 74735
          first_tpid_year=2011
        ).put()

        # We can skip 2000 records, paginate, and still get frc4409 and frc4410 in 2012
        self.datafeed.getTeamsTpids(2012, skip=2000)

        # Check new team insertion
        frc4410 = Team.get_by_id("frc4410")
        self.assertEqual(frc4410.team_number, 4410)
        self.assertEqual(frc4410.first_tpid, 74193)
        self.assertEqual(frc4410.first_tpid_year, 2012)

        # Check old team updating
        frc4409 = Team.get_by_id("frc4409")
        self.assertEqual(frc4409.team_number, 4409)
        self.assertEqual(frc4409.first_tpid, 74735)
        self.assertEqual(frc4409.first_tpid_year, 2012)
开发者ID:BowlesCR,项目名称:the-blue-alliance,代码行数:53,代码来源:test_datafeed_usfirst_legacy_teams.py


示例13: get

    def get(self, key_name):
        # Combines data from three datafeeds with priorities:
        # 1) DatafeedFMSAPI
        # 2) DatafeedUsfirst (missing rookie year)
        # 3) DatafeedUsfirstLegacy (has all info)

        legacy_df = DatafeedUsfirstLegacy()
        usfirst_df = DatafeedUsfirst()
        fms_df = DatafeedFMSAPI('v2.0')

        # Start with lowest priority
        legacy_team = legacy_df.getTeamDetails(Team.get_by_id(key_name))
        usfirst_team = usfirst_df.getTeamDetails(Team.get_by_id(key_name))
        fms_details = fms_df.getTeamDetails(tba_config.MAX_YEAR, key_name)

        # Separate out the multiple models returned from FMSAPI call
        # Since we're only hitting one team at a time, the response won't
        # ever be paginated so we can ignore the possibility
        if fms_details and fms_details[0]:
            models, more_pages = fms_details
            fms_team, district_team, robot = models[0]
        else:
            fms_team = None
            district_team = None
            robot = None

        team = None
        if usfirst_team:
            team = TeamManipulator.updateMergeBase(usfirst_team, legacy_team)
        if fms_team:
            team = TeamManipulator.updateMergeBase(fms_team, team)

        if district_team:
            district_team = DistrictTeamManipulator.createOrUpdate(district_team)
        if robot:
            robot = RobotManipulator.createOrUpdate(robot)
        if team:
            team = TeamManipulator.createOrUpdate(team)
            success = True
        else:
            success = False
            logging.warning("getTeamDetails failed for team: {}".format(key_name))

        template_values = {
            'key_name': key_name,
            'team': team,
            'success': success,
            'district': district_team,
            'robot': robot,
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_team_details_get.html')
        self.response.out.write(template.render(path, template_values))
开发者ID:arilotter,项目名称:the-blue-alliance,代码行数:53,代码来源:datafeed_controller.py


示例14: TestDatafeedUsfirstTeams

class TestDatafeedUsfirstTeams(unittest2.TestCase):
    def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_urlfetch_stub()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_memcache_stub()

        self.datafeed = DatafeedUsfirst()

        self.team177 = Team(
            id="frc177",
            team_number=177,
            first_tpid=61771,
            first_tpid_year=2012
        )
        self.team177.put()

    def tearDown(self):
        self.testbed.deactivate()

    def test_getTeamDetails(self):
        team = self.datafeed.getTeamDetails(self.team177)

        ## Broken as result of FIRST website redesign -gregmarra 20151122
        # self.assertEqual(team.name, "UTC Power/Ensign Bickford Aerospace & Defense & South Windsor High School")
        # self.assertEqual(team.address, u"South Windsor, CT, USA")
        # self.assertEqual(team.nickname, "Bobcat Robotics")
        # self.assertEqual(team.website, "http://www.bobcatrobotics.org")

    def test_getTeamsTpids(self):
        Team(
          id="frc4409",
          team_number=4409,
          first_tpid=0,  # should be 74735
          first_tpid_year=2011
        ).put()

        # We can skip 2000 records, paginate, and still get frc4409 and frc4410 in 2012
        self.datafeed.getTeamsTpids(2012, skip=2000)

        # Check new team insertion
        frc4410 = Team.get_by_id("frc4410")
        self.assertEqual(frc4410.team_number, 4410)
        self.assertEqual(frc4410.first_tpid, 74193)
        self.assertEqual(frc4410.first_tpid_year, 2012)

        # Check old team updating
        frc4409 = Team.get_by_id("frc4409")
        self.assertEqual(frc4409.team_number, 4409)
        self.assertEqual(frc4409.first_tpid, 74735)
        self.assertEqual(frc4409.first_tpid_year, 2012)
开发者ID:arilotter,项目名称:the-blue-alliance,代码行数:52,代码来源:test_datafeed_usfirst_teams.py


示例15: store_team

def store_team(data):
    team = Team(id=data['key'])
    team.team_number = data['team_number']
    team.nickname = data['nickname']
    team.name = data['name']
    team.website = data['website']
    team.rookie_year = data['rookie_year']
    team.motto = data['motto']
    team.city = data['city']
    team.state_prov = data['state_prov']
    team.country = data['country']

    TeamManipulator.createOrUpdate(team)
    return team
开发者ID:fangeugene,项目名称:the-blue-alliance,代码行数:14,代码来源:bootstrap.py


示例16: get

    def get(self, key_name):
        # Combines data from three datafeeds with priorities:
        # 1) DatafeedFMSAPI (missing website)
        # 2) DatafeedUsfirst (missing rookie year)
        # 3) DatafeedUsfirstLegacy (has all info)

        legacy_df = DatafeedUsfirstLegacy()
        usfirst_df = DatafeedUsfirst()
        fms_df = DatafeedFMSAPI('v2.0')

        # Start with lowest priority
        legacy_team = legacy_df.getTeamDetails(Team.get_by_id(key_name))
        usfirst_team = usfirst_df.getTeamDetails(Team.get_by_id(key_name))
        fms_details = fms_df.getTeamDetails(date.today().year, key_name)

        if fms_details:
            fms_team, district_team, robot = fms_details
        else:
            fms_team = None
            district_team = None
            robot = None

        team = None
        if usfirst_team:
            team = TeamManipulator.updateMergeBase(usfirst_team, legacy_team)
        if fms_team:
            team = TeamManipulator.updateMergeBase(fms_team, team)

        if district_team:
            district_team = DistrictTeamManipulator.createOrUpdate(district_team)
        if robot:
            robot = RobotManipulator.createOrUpdate(robot)
        if team:
            team = TeamManipulator.createOrUpdate(team)
            success = True
        else:
            success = False
            logging.warning("getTeamDetails failed for team: {}".format(key_name))

        template_values = {
            'key_name': key_name,
            'team': team,
            'success': success,
            'district': district_team,
            'robot': robot,
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_team_details_get.html')
        self.response.out.write(template.render(path, template_values))
开发者ID:RCB35,项目名称:the-blue-alliance,代码行数:49,代码来源:datafeed_controller.py


示例17: TestTeamApiController

class TestTeamApiController(unittest2.TestCase):
    def setUp(self):
        app = webapp2.WSGIApplication([webapp2.Route(r'/<team_key:>', ApiTeamController, methods=['GET'])], debug=True)
        self.testapp = webtest.TestApp(app)

        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_urlfetch_stub()
        self.testbed.init_memcache_stub()
        self.testbed.init_taskqueue_stub(root_path=".")

        self.team = Team(
                id="frc281",
                name="Michelin / Caterpillar / Greenville Technical College /\
                jcpenney / Baldor / ASME / Gastroenterology Associates /\
                Laserflex South & Greenville County Schools & Greenville\
                Technical Charter High School",
                team_number=281,
                rookie_year=1999,
                nickname="EnTech GreenVillians",
                city="Greenville",
                state_prov="SC",
                country="USA",
                website="www.entech.org",
                motto = "Infiltrating Young Minds One Robot at a Time",
        )
        self.team.put()

    def tearDown(self):
        self.testbed.deactivate()

    def assertTeamJson(self, team):
        self.assertEqual(team["key"], self.team.key_name)
        self.assertEqual(team["team_number"], self.team.team_number)
        self.assertEqual(team["nickname"], self.team.nickname)
        self.assertEqual(team["location"], self.team.location)
        self.assertEqual(team["locality"], "Greenville")
        self.assertEqual(team["country_name"], "USA")
        self.assertEqual(team["region"], "SC")
        self.assertEqual(team["website"], self.team.website)
        self.assertEqual(team["rookie_year"], self.team.rookie_year)
        self.assertEqual(team["motto"], self.team.motto)

    def testTeamApi(self):
        response = self.testapp.get('/frc281', headers={"X-TBA-App-Id": "tba-tests:team-controller-test:v01"})

        team_dict = json.loads(response.body)
        self.assertTeamJson(team_dict)
开发者ID:CarterFendley,项目名称:the-blue-alliance,代码行数:49,代码来源:test_apiv2_team_controller.py


示例18: delete

 def delete(self, *args, **kwargs):
     if 'user' not in kwargs or not args:
         self.raise401()
     user = kwargs['user']
     path = parse_path(args[0])
     team = Team.objects(name=path[0]).first()
     if not team or user not in team.members:
         self.raise401()
     try:
         Team.objects(name=path[0]).delete()
         self.set_status(204)
         self.finish()
     except Exception as e:
         reason = e.message
         self.raise400(reason=reason)
开发者ID:hitigon,项目名称:warehouse,代码行数:15,代码来源:team.py


示例19: _process_project

 def _process_project(self, project):
     team = Team.objects(team_id=project.namespace.id).first()
     # We reset team statistics when we first encounter it
     if team and project.namespace.id not in self.teams_seen:
         team.delete()
         team = None
         self.teams_seen.add(project.namespace.id)
     if not team:
         team = Team(team_id=project.namespace.id)
     for (lang, total) in self._lang_stats(project).items():
         if lang in team.languages:
             team.languages[lang] += total
         else:
             team.languages[lang] = total
     team.save()
开发者ID:globocom,项目名称:vitrine,代码行数:15,代码来源:worker.py


示例20: test_create_lots_of_teams

    def test_create_lots_of_teams(self):
        number = 500
        teams = [Team(
            id = "frc%s" % team_number,
            team_number = team_number)
            for team_number in range(number)]
        TeamManipulator.createOrUpdate(teams)

        team = Team.get_by_id("frc177")
        self.assertEqual(team.key_name, "frc177")
        self.assertEqual(team.team_number, 177)

        team = Team.get_by_id("frc%s" % (number - 1))
        self.assertEqual(team.key_name, "frc%s" % (number - 1))
        self.assertEqual(team.team_number, number - 1)
开发者ID:dweitz,项目名称:the-blue-alliance,代码行数:15,代码来源:test_team_manipulator.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python timers.getTimers函数代码示例发布时间:2022-05-27
下一篇:
Python suggestion.Suggestion类代码示例发布时间: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