예제 #1
0
    def test_load_city_spotids(self):
        from application.models.spot import CitySpotIds
        csi = CitySpotIds(
            "TXG",
            [
                "001096",
                "001076",
                "001099",
                "001094",
                "001093"
            ]
        )

        ab = Abroad(get_api_key())
        cs = ab.load_city_spots(csi)
        self.assertTrue(cs)
        self.assertEqual(len(csi.spot_ids), len(cs.spots))
예제 #2
0
    def __init__(self):
        handlers = [
            (r"/", IndexHandler),
            (r"/group", GroupHandler),
            (r"/agent/([^/]+)", AgentIndexHandler),
            (r"/agent/([^/]+)/train", AgentHandler),
            (r"/agent/([^/]+)/result", ResultHandler),
        ]
        settings = dict(
            cookie_secret=os.environ.get("SECRET_TOKEN", "__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__"),
            template_path=os.path.join(os.path.dirname(__file__), "templates"),
            static_path=os.path.join(os.path.dirname(__file__), "static"),
            xsrf_cookies=True,
            debug=True,
            api_key=get_api_key()
        )

        data_dir = os.path.join(os.path.dirname(__file__), "../data/release")
        AgentHandler.load_brain(data_dir)

        tornado.web.Application.__init__(self, handlers, **settings)
예제 #3
0
 def test_get_city(self):
     ab = Abroad(get_api_key())
     city = ab.get_city("NYC")
     self.assertTrue(city)
예제 #4
0
 def test_get_tour(self):
     ab = Abroad(get_api_key())
     tours = ab.get_tour("BCN", "都市")
     self.assertTrue(len(tours) > 0)
     print(tours)