Пример #1
0
    def _do_conditions(self):
        service = AccuWeatherService(ServiceConfiguration.from_data("rest", "accuweather", "weather"))
        self.assertIsNotNone(service)

        client = AccuWeatherServiceTestClient()
        service.initialise(client)

        response = service.conditions("3385695")
        self.assertResponse(response, 'conditions', 'accuweather', 'weather')
Пример #2
0
    def load_storage(self):
        super(ServiceHandlerTestClient, self).load_storage()

        self.add_license_keys_store(filepath=os.path.dirname(__file__) + os.sep + "testdata" + os.sep + "license.keys")

        self.add_services_store(dirs=[MetOfficeService.get_default_conf_file(),
                                      WikipediaService.get_default_conf_file(),
                                      AccuWeatherService.get_default_conf_file(),
                                      CocktailDBService.get_default_conf_file(),
                                      DarkSkyService.get_default_conf_file(),
                                      DuckDuckGoService.get_default_conf_file(),
                                      GenericService.get_default_conf_file(),
                                      GeoNamesService.get_default_conf_file(),
                                      GetGuidelinesService.get_default_conf_file(),
                                      GNewsService.get_default_conf_file(),
                                      GoodReadsService.get_default_conf_file(),
                                      GoogleGeoCodeService.get_default_conf_file(),
                                      GoogleDistanceService.get_default_conf_file(),
                                      GoogleDirectionsService.get_default_conf_file(),
                                      NewsAPIService.get_default_conf_file(),
                                      OMDBService.get_default_conf_file(),
                                      PandoraService.get_default_conf_file(),
                                      ProgramyService.get_default_conf_file(),
                                      WolframAlphaService.get_default_conf_file(),
                                      WorldTradingDataStocksService.get_default_conf_file()
                                      ])
        self.add_pattern_nodes_store()
        self.add_template_nodes_store()
Пример #3
0
    def test_weather_location_aiml(self):
        client = AccuWeatherServiceTestClient()
        conf_file = AccuWeatherService.get_default_conf_file()

        response = self._do_handler_load(client, conf_file, "accuweather", "ACCUWEATHER WEATHER LOCATION KINGHORN")
        self.assertIsNotNone(response)
        self.assertTrue(response.startswith("It is currently"))
Пример #4
0
    def test_conditions_location_aiml(self):
        client = AccuWeatherServiceTestClient()
        conf_file = AccuWeatherService.get_default_conf_file()

        response = self._do_handler_load(client, conf_file, "accuweather", "ACCUWEATHER CONDITIONS LOCATION KINGHORN")
        self.assertIsNotNone(response)
        self.assertEqual("It is currently -0.7 C and Cloudy.", response)
Пример #5
0
    def test_handler_load_textsearch(self):
        client = AccuWeatherServiceTestClient()
        conf_file = AccuWeatherService.get_default_conf_file()

        response = self._do_handler_load(client, conf_file, "accuweather", "ACCUWEATHER TEXTSEARCH LOCATION KINGHORN")
        self.assertIsNotNone(response)
        self.assertEqual("ACCUWEATHER RESULT KEY 3385695.", response)
Пример #6
0
    def _do_textsearch(self):
        service = AccuWeatherService(ServiceConfiguration.from_data("rest", "accuweather", "weather"))
        self.assertIsNotNone(service)

        client = AccuWeatherServiceTestClient()
        service.initialise(client)

        response = service.textsearch("Kinghorn")
        self.assertResponse(response, 'textsearch', 'accuweather', 'weather')

        key = AccuWeatherService.get_location_key(response)
        self.assertIsNotNone(key)
        self.assertEquals("3385695", key)
Пример #7
0
    def _do_postcodesearch(self):
        service = AccuWeatherService(ServiceConfiguration.from_data("rest", "accuweather", "weather"))
        self.assertIsNotNone(service)

        client = AccuWeatherServiceTestClient()
        service.initialise(client)

        response = service.postcodesearch("KY3 9UR")
        self.assertResponse(response, 'postcodesearch', 'accuweather', 'weather')

        key = AccuWeatherService.get_location_key(response)
        self.assertIsNotNone(key)
        self.assertEquals("47724_PC", key)
Пример #8
0
 def test_init(self):
     service = AccuWeatherService(ServiceConfiguration.from_data("rest", "omdb", "film"))
     self.assertIsNotNone(service)