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

        self.datafeed = DatafeedFms()
    def get(self):
        df = DatafeedFms()
        teams = df.getFmsTeamList()
        TeamManipulator.createOrUpdate(teams)

        template_values = {"teams": teams}

        path = os.path.join(os.path.dirname(__file__),
                            '../templates/datafeeds/fms_team_list_get.html')
        self.response.out.write(template.render(path, template_values))
    def get(self):
        df = DatafeedFms()
        teams = df.getFmsTeamList()
        TeamManipulator.createOrUpdate(teams)

        template_values = {
            "teams": teams
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/fms_team_list_get.html')
        self.response.out.write(template.render(path, template_values))
    def get(self):
        df = DatafeedFms()
        events = df.getFmsEventList()

        # filter if first_eid is too high, meaning its a Championship Division
        # (we manually add these due to naming issues)
        events = filter(lambda e: int(e.first_eid) < 100000, events)

        events = EventManipulator.createOrUpdate(events)

        template_values = {"events": events}

        path = os.path.join(os.path.dirname(__file__),
                            '../templates/datafeeds/fms_event_list_get.html')
        self.response.out.write(template.render(path, template_values))
    def get(self):
        df = DatafeedFms()
        events = df.getFmsEventList()

        # filter if first_eid is too high, meaning its a Championship Division
        # (we manually add these due to naming issues)
        events = filter(lambda e: int(e.first_eid) < 100000, events)

        events = EventManipulator.createOrUpdate(events)

        template_values = {
            "events": events
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/fms_event_list_get.html')
        self.response.out.write(template.render(path, template_values))
class TestDatafeedFmsTeams(unittest2.TestCase):

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

        self.datafeed = DatafeedFms()

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

    def test_getFmsTeamList(self):
        return # disabled 2014-12-23
        teams = self.datafeed.getFmsTeamList()
        self.find177(teams)

    def find177(self, teams):
        found_177 = False
        for team in teams:
            if team.team_number == 177:
                found_177 = True
                self.assertEqual(team.name, "United Technologies / ClearEdge Power / Gain Talent / EBA&D & South Windsor High School")
                #self.assertEqual(team.address, u"South Windsor, CT, USA")
                self.assertEqual(team.nickname, "Bobcat Robotics")

                break

        self.assertTrue(found_177)
        self.assertTrue(len(teams) > 0)
class TestDatafeedFmsTeams(unittest2.TestCase):

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

        self.datafeed = DatafeedFms()

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

    def test_getFmsTeamList(self):
        teams = self.datafeed.getFmsTeamList()
        self.find177(teams)

    def find177(self, teams):
        found_177 = False
        for team in teams:
            if team.team_number == 177:
                found_177 = True
                self.assertEqual(team.name, "UTC / Ensign Bickford Aerospace & Defense & South Windsor High School")
                #self.assertEqual(team.address, u"South Windsor, CT, USA")
                self.assertEqual(team.nickname, "Bobcat Robotics")

        self.assertTrue(found_177)
        self.assertTrue(len(teams) > 0)
class TestDatafeedFmsEvents(unittest2.TestCase):
    
    def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_urlfetch_stub()
        
        self.datafeed = DatafeedFms()
    
    def tearDown(self):
        self.testbed.deactivate()
    
    def test_getFmsEventList(self):
        events = self.datafeed.getFmsEventList()
        self.findCT(events)
    
    def findCT(self, events):
        found_ct = False
        for event in events:
            if event.event_short == "ct":
                found_ct = True
                self.assertEqual(event.key.id(), "2012ct")
                self.assertEqual(event.end_date, datetime.datetime(2012, 03, 31))
                self.assertEqual(event.event_short, "ct")
                self.assertEqual(event.first_eid, "7627")
                self.assertEqual(event.location, "Hartford, CT")
                self.assertEqual(event.name, "Northeast Utilities FIRST Connecticut Regional")
                self.assertEqual(event.official, True)
                self.assertEqual(event.start_date, datetime.datetime(2012, 03, 29))
                self.assertEqual(event.venue, "Connecticut Convention Center")
                self.assertEqual(event.year, 2012)
        
        self.assertTrue(found_ct)
        self.assertTrue(len(events) > 0)
Ejemplo n.º 9
0
class TestDatafeedFmsEvents(unittest2.TestCase):

    def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_urlfetch_stub()

        self.datafeed = DatafeedFms()

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

    def test_getFmsEventList(self):
        events = self.datafeed.getFmsEventList()
        self.assertTrue(self.find2014CT(events))

    def find2012CT(self, events):
        found_ct = False
        for event in events:
            if event.event_short == "ct":
                found_ct = True
                self.assertEqual(event.key.id(), "2012ct")
                self.assertEqual(event.end_date, datetime.datetime(2012, 03, 31))
                self.assertEqual(event.event_short, "ct")
                self.assertEqual(event.first_eid, "7627")
                #self.assertEqual(event.location, "Hartford, CT")
                self.assertEqual(event.name, "Northeast Utilities FIRST Connecticut Regional")
                self.assertEqual(event.official, True)
                self.assertEqual(event.start_date, datetime.datetime(2012, 03, 29))
                self.assertEqual(event.venue, "Connecticut Convention Center")
                self.assertEqual(event.year, 2012)

        return found_ct

    def find2013CT(self, events):
        found_ct = False
        for event in events:
            if event.event_short == "ctha":
                found_ct = True
                self.assertEqual(event.key.id(), "2013ctha")
                self.assertEqual(event.end_date, datetime.datetime(2013, 03, 30))
                self.assertEqual(event.event_short, "ctha")
                self.assertEqual(event.first_eid, "8985")
                #self.assertEqual(event.location, "Hartford, CT")
                self.assertEqual(event.name, "Connecticut Regional sponsored by UTC")
                self.assertEqual(event.official, True)
                self.assertEqual(event.start_date, datetime.datetime(2013, 03, 28))
                self.assertEqual(event.venue, "Connecticut Convention Center")
                self.assertEqual(event.year, 2013)

        return found_ct

    def find2014CT(self, events):
        found_ct = False
        for event in events:
            if event.event_short == "cthar":
                found_ct = True
                self.assertEqual(event.key.id(), "2014cthar")
                self.assertEqual(event.end_date, datetime.datetime(2014, 03, 30))
                self.assertEqual(event.event_short, "cthar")
                self.assertEqual(event.first_eid, "10893")
                #self.assertEqual(event.location, "Hartford, CT")
                self.assertEqual(event.name, "Hartford District Event")
                self.assertEqual(event.official, True)
                self.assertEqual(event.start_date, datetime.datetime(2014, 03, 29))
                self.assertEqual(event.venue, "Hartford Public High School")
                self.assertEqual(event.year, 2014)

        return found_ct