def test_init_with_license_keys(self): met_office = MetOffice() self.assertIsNotNone(met_office) license_keys = LicenseKeys() license_keys.add_key('METOFFICE_API_KEY', "ABCDEFGHIJKL") met_office.check_for_license_keys(license_keys) self.assertIsNotNone(met_office._met_office_api)
def __init__(self, brain, config: BotConfiguration): self._brain = brain self._configuration = config self._conversations = {} self._license_keys = LicenseKeys() self._load_license_keys(self._configuration) self._question_depth = 0
def test_extract_license_key_null_attr(self): config = BaseConfigurationData("test") license_keys = LicenseKeys() license_keys.add_key("key", "value") self.assertEqual(None, config._extract_license_key(None, license_keys))
def setUp(self): self.license_keys = LicenseKeys() self.license_keys.load_license_key_file( os.path.dirname(__file__) + "/test.keys") self.lat = 56.0720397 self.lng = -3.1752001
def test_get_news_feed_articles_none_200_response(self): self.license_keys = LicenseKeys() self.license_keys.load_license_key_file( os.path.dirname(__file__) + "/test.keys") mock_api = MockNewsApiApi() newsapi = NewsAPI(self.license_keys, mock_api) self.assertIsNotNone(newsapi) mock_api.response = MockResponse( 401, {"content-type": "application/json"}, json.loads(""" { "articles": [ { "title": "test title", "description": "test description", "publishedAt": "test publishedAt", "author": "test author", "url": "test url", "urlToImage": "test urlToImage" } ] } """)) mock_url = NewsAPI._format_url("testservice", "key") articles = newsapi._get_news_feed_articles(mock_url, 10, True, False) self.assertIsNotNone(articles) self.assertEqual(0, len(articles))
def setUp(self): self.license_keys = LicenseKeys() self.license_keys.load_license_key_file( os.path.dirname(__file__) + "/../../../../bots/y-bot/config/license.keys") self.lat = 56.0720397 self.lng = -3.1752001
def load_license_keys(self): # TODO Move this to License keys base class self._license_keys = LicenseKeys() if self._configuration is not None: self._load_license_keys(self._configuration) else: if logging.getLogger().isEnabledFor(logging.WARNING): logging.warning("No configuration defined when loading license keys")
def test_extract_license_key_diff_key2(self): config = BaseConfigurationData("test") license_keys = LicenseKeys() license_keys.add_key("key", "value") self.assertEqual( None, config._extract_license_key("LICENSE:keyX", license_keys))
def test_add_keys(self): keys = LicenseKeys() self.assertFalse(keys.has_key("KEY1")) keys.add_key("KEY1", "VALUE1") self.assertTrue(keys.has_key("KEY1")) self.assertEqual("VALUE1", keys.get_key("KEY1")) keys.add_key("KEY1", "VALUE2") self.assertTrue(keys.has_key("KEY1")) self.assertEqual("VALUE2", keys.get_key("KEY1"))
class NewsAPIExtensionTests(unittest.TestCase): def setUp(self): self.license_keys = LicenseKeys() self.license_keys.load_license_key_file( os.path.dirname(__file__) + "/test.keys") def test_init(self): newsapi = NewsAPI(self.license_keys) self.assertIsNotNone(newsapi)
class NewsAPIExtensionIntegrationTests(unittest.TestCase): def setUp(self): self.license_keys = LicenseKeys() self.license_keys.load_license_key_file(os.path.dirname(__file__)+"/../../../../bots/y-bot/config/license.keys") def test_init(self): newsapi = NewsAPI(self.license_keys) self.assertIsNotNone(newsapi) articles = newsapi.get_headlines(NewsAPI.BBC_NEWS) self.assertIsNotNone(articles)
class NewsAPIExtensionIntegrationTests(unittest.TestCase): def setUp(self): self.license_keys = LicenseKeys() self.license_keys.load_license_key_file( os.path.dirname(__file__) + "/../../../../bots/y-bot/config/license.keys") def test_init(self): newsapi = NewsAPI(self.license_keys) self.assertIsNotNone(newsapi) articles = newsapi.get_headlines(NewsAPI.BBC_NEWS) self.assertIsNotNone(articles)
def test_geonames(self): license_keys = LicenseKeys() license_keys.load_license_key_file(os.path.dirname(__file__)+"/test.keys") geonames = GeoNamesApi(license_keys) self.assertIsNotNone(geonames) GeoNamesApi.get_latlong_for_postcode_response_file = os.path.dirname(__file__)+"/postcode.json" latlng = geonames.get_latlong_for_postcode('KY39UR') self.assertIsNotNone(latlng) self.assertEquals(latlng.latitude, 56.07206267570594) self.assertEquals(latlng.longitude, -3.175233048730664)
def test_geonames(self): license_keys = LicenseKeys() license_keys.load_license_key_file(os.path.dirname(__file__)+ os.sep + "test.keys") geonames = GeoNamesApi(license_keys) self.assertIsNotNone(geonames) GeoNamesApi.get_latlong_for_postcode_response_file = os.path.dirname(__file__)+ os.sep + "geonames_latlong.json" latlng = geonames.get_latlong_for_postcode('KY39UR') self.assertIsNotNone(latlng) self.assertEquals(latlng.latitude, 56.07206267570594) self.assertEquals(latlng.longitude, -3.175233048730664)
class GeoNamesTests(unittest.TestCase): def setUp(self): self.license_keys = LicenseKeys() self.license_keys.load_license_key_file(os.path.dirname(__file__) + "/../../../../bots/y-bot/config/license.keys") def test_geonames(self): geonames = GeoNamesApi(self.license_keys) self.assertIsNotNone(geonames) latlng = geonames.get_latlong_for_postcode('KY39UR') self.assertIsNotNone(latlng) self.assertEquals(latlng.latitude, 56.07206267570594) self.assertEquals(latlng.longitude, -3.175233048730664)
def test_with_data(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text( """ console: email: host: 127.0.0.1 port: 80 username: emailuser password: emailpassword from_addr: emailfromuser """, ConsoleConfiguration(), ".") client_config = yaml.get_section("console") email_config = EmailConfiguration() email_config.load_config_section(yaml, client_config, ".") license_keys = LicenseKeys() email_config.check_for_license_keys(license_keys) self.assertEqual("127.0.0.1", email_config.host) self.assertEqual(80, email_config.port) self.assertEqual("emailuser", email_config.username) self.assertEqual("emailpassword", email_config.password) self.assertEqual("emailfromuser", email_config.from_addr)
class GeoNamesTests(unittest.TestCase): def setUp(self): self.license_keys = LicenseKeys() self.license_keys.load_license_key_file( os.path.dirname(__file__) + "/../../../../bots/y-bot/config/license.keys") def test_geonames(self): geonames = GeoNamesApi(self.license_keys) self.assertIsNotNone(geonames) latlng = geonames.get_latlong_for_postcode('KY39UR') self.assertIsNotNone(latlng) self.assertEqual(latlng.latitude, 56.07206267570594) self.assertEqual(latlng.longitude, -3.175233048730664)
def test_with_data(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text(""" bot: conversations: max_histories: 666 initial_topic: topic1 restore_last_topic: true multi_client: true """, ConsoleConfiguration(), ".") bot_config = yaml.get_section("bot") convo_config = BotConversationsConfiguration() convo_config.load_config_section(yaml, bot_config, ".") license_keys = LicenseKeys() convo_config.check_for_license_keys(license_keys) self.assertEqual(convo_config.section_name, "conversations") self.assertEqual(666, convo_config.max_histories) self.assertEqual("topic1", convo_config.initial_topic) self.assertTrue(convo_config.restore_last_topic) self.assertTrue(convo_config.multi_client)
def test_get_news_feed_articles_content_not_json(self): self.license_keys = LicenseKeys() self.license_keys.load_license_key_file(os.path.dirname(__file__)+ os.sep + "test.keys") mock_api = MockNewsApiApi() newsapi = NewsAPI(self.license_keys, mock_api) self.assertIsNotNone(newsapi) mock_api.response = MockResponse(200, {"content-type": "application/xml"}, None) mock_url = NewsAPI._format_url("testservice", "key") articles = newsapi._get_news_feed_articles(mock_url, 10, True, False) self.assertIsNotNone(articles) self.assertEqual(0, len(articles))
def test_with_data(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text( """ bot: translator: classname: programy.nlp.translate.textblob_translator.TextBlobTranslator from: fr to: en """, ConsoleConfiguration(), ".") bot_config = yaml.get_section("bot") translator_config = BotTranslatorConfiguration(name="translator") translator_config.load_config_section(yaml, bot_config, ".") license_keys = LicenseKeys() translator_config.check_for_license_keys(license_keys) self.assertEqual( "programy.nlp.translate.textblob_translator.TextBlobTranslator", translator_config.classname) self.assertEqual("en", translator_config.to_lang) self.assertEqual("fr", translator_config.from_lang)
def test_with_data(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text( """ bot: spelling: classname: programy.spelling.norvig.NorvigSpellingChecker alphabet: abcdefghijklmnopqrstuvwxyz check_before: true check_and_retry: true """, ConsoleConfiguration(), ".") bot_config = yaml.get_section("bot") spelling_config = BotSpellingConfiguration() spelling_config.load_config_section(yaml, bot_config, ".") license_keys = LicenseKeys() spelling_config.check_for_license_keys(license_keys) self.assertEqual("programy.spelling.norvig.NorvigSpellingChecker", spelling_config.classname) self.assertEqual("abcdefghijklmnopqrstuvwxyz", spelling_config.alphabet) self.assertTrue(spelling_config.check_before) self.assertTrue(spelling_config.check_and_retry)
def __init__(self, id, argument_parser=None): self._id = id self._license_keys = LicenseKeys() self._storage = None self._scheduler = None self._configuration = None self._arguments = self.parse_arguments(argument_parser=argument_parser) self.initiate_logging(self.arguments) self.load_configuration(self.arguments) self.parse_configuration() self.load_storage() self._bot_factory = BotFactory(self, self.configuration.client_configuration) self.load_license_keys() self.get_license_keys() self.load_scheduler() self._renderer = self.load_renderer()
def test_ask_question_no_botid(self): self.bot = TestBot() self.bot.license_keys = LicenseKeys() config = BrainServiceConfiguration("pandora") config._url = "http://test.pandora.url" service = PandoraService(config=config, api=MockPandoraAPI(response="Test pandora response")) self.assertIsNotNone(service) response = service.ask_question(self.bot, "testid", "what is a cat") self.assertEquals("", response)
def test_geonames_license_keys(self): license_keys = LicenseKeys() license_keys.add_key('GEO_NAMES_COUNTRY', "UK") license_keys.add_key('GEO_NAMES_ACCOUNTNAME', "TestAccount1") geonames = GeoNamesApi() geonames.check_for_license_keys(license_keys) self.assertEqual("UK", geonames.country) self.assertEqual("TestAccount1", geonames.account_name)
def test_check_for_license_keys(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text(""" brain: """, ConsoleConfiguration(), ".") brain_section = yaml.get_section("brain") brain_configuration = BrainConfiguration() brain_configuration.load_configuration(yaml, brain_section, ".") license_keys = LicenseKeys() brain_configuration.check_for_license_keys(license_keys)
def test_ask_question_no_license_key(self): self.bot = TestBot() self.bot.license_keys = LicenseKeys() config = BrainServiceConfiguration("pannous") config.set_parameter("url", "http://test.pandora.url") service = PannousService( config=config, api=MockPannousAPI(response="Test pannous response")) self.assertIsNotNone(service) response = service.ask_question(self.bot, "testid", "what is a cat") self.assertEquals("", response)
def test_process_license_key_line(self): config = FileStorageConfiguration() engine = FileStorageEngine(config) engine.initialise() store = FileLicenseStore(engine) license_keys = LicenseKeys() self.assertFalse(store._process_license_key_line(license_keys, "")) self.assertFalse(store._process_license_key_line(license_keys, "#")) self.assertFalse( store._process_license_key_line(license_keys, "# Comment")) self.assertFalse( store._process_license_key_line(license_keys, "INVALID:Key")) self.assertTrue( store._process_license_key_line(license_keys, "VALID=KEY"))
def __init__(self, botid, argument_parser=None): self._id = botid self._license_keys = LicenseKeys() self._storage = None self._scheduler = None self._email = None self._trigger_mgr = None self._configuration = None self._ping_responder = None self._questions = 0 self._arguments = self.parse_arguments(argument_parser=argument_parser) self.initiate_logging(self.arguments) self._subsitutions = Substitutions() if self.arguments.substitutions is not None: self._subsitutions.load_substitutions(self.arguments.substitutions) self.load_configuration(self.arguments) self.parse_configuration() self.load_storage() self.load_license_keys() self.get_license_keys() self._configuration.client_configuration.check_for_license_keys( self._license_keys) self._bot_factory = BotFactory(self, self.configuration.client_configuration) self.load_scheduler() self._renderer = None self.load_renderer() self.load_email() self.load_trigger_manager() self.load_ping_responder() self.post_initialise()
def test_with_data(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text(""" bot: splitter: classname: programy.dialog.splitter.regex.RegexSentenceSplitter """, ConsoleConfiguration(), ".") bot_config = yaml.get_section("bot") splitter_config = BotSentenceSplitterConfiguration() splitter_config.load_config_section(yaml, bot_config, ".") license_keys = LicenseKeys() splitter_config.check_for_license_keys(license_keys) self.assertEqual("programy.dialog.splitter.regex.RegexSentenceSplitter", splitter_config.classname) self.assertEqual('[:;,.?!]', splitter_config.split_chars)
def assert_upload_license_keys_from_file(self, store): store.empty() store.upload_from_file( os.path.dirname(__file__) + os.sep + "data" + os.sep + "licenses" + os.sep + "test_license.keys") license_keys = LicenseKeys() store.load(license_keys) self.assertTrue(license_keys.has_key("TESTKEY1")) self.assertEqual("VALUE1", license_keys.get_key("TESTKEY1")) self.assertTrue(license_keys.has_key("TESTKEY2")) self.assertEqual("VERY LONG VALUE 2", license_keys.get_key("TESTKEY2"))
def __init__(self, id, argument_parser=None): self._id = id self._license_keys = LicenseKeys() self._storage = None self._scheduler = None self._email = None self._trigger_mgr = None self._configuration = None self._bot_root = '.' self._engine_version = None self._arguments = self.parse_arguments(argument_parser=argument_parser) self._engine_version = self._arguments.version self.initiate_logging(self.arguments) self._subsitutions = Substitutions() if self.arguments.substitutions is not None: self._subsitutions.load_substitutions(self.arguments.substitutions) self.load_configuration(self.arguments, subs=self._subsitutions) else: self.load_configuration(self.arguments) self.parse_configuration() self.load_storage() self._bot_factory = BotFactory(self, self.configuration.client_configuration) self.load_license_keys() self.get_license_keys() self._configuration.client_configuration.check_for_license_keys( self._license_keys) self.load_scheduler() self.load_renderer() self.load_email() self.load_trigger_manager()
def __init__(self, id, argument_parser=None): self._id = id self._arguments = self.parse_arguments(argument_parser=argument_parser) self.initiate_logging(self.arguments) self._configuration = None self.load_configuration(self.arguments) self.parse_configuration() self._bot_factory = BotFactory(self, self.configuration.client_configuration) self._license_keys = LicenseKeys() self.load_license_keys() self.get_license_keys() self._scheduler = None self.load_scheduler() self._renderer = self.load_renderer()
def test_load_license_key(self): config = FileStorageConfiguration() config._license_storage = FileStoreConfiguration(file=os.path.dirname(__file__) + os.sep + "data" + os.sep + "licenses" + os.sep + "test_license.keys", format="text", encoding="utf-8", delete_on_start=False) engine = FileStorageEngine(config) engine.initialise() store = FileLicenseStore(engine) store.empty() license_keys = LicenseKeys() store.load(license_keys) self.assertTrue(license_keys.has_key("TESTKEY1")) self.assertEqual("VALUE1", license_keys.get_key("TESTKEY1")) self.assertTrue(license_keys.has_key("TESTKEY2")) self.assertEqual("VERY LONG VALUE 2", license_keys.get_key("TESTKEY2"))
def test_with_data(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text( """ bot: joiner: classname: programy.dialog.joiner.SentenceJoiner """, ConsoleConfiguration(), ".") bot_config = yaml.get_section("bot") joiner_config = BotSentenceJoinerConfiguration() joiner_config.load_config_section(yaml, bot_config, ".") license_keys = LicenseKeys() joiner_config.check_for_license_keys(license_keys) self.assertEqual("programy.dialog.joiner.SentenceJoiner", joiner_config.classname) self.assertEqual('.?!', joiner_config.join_chars) self.assertEqual('.', joiner_config.terminator)
def test_with_data(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text( """ bot: sentiment: classname: programy.nlp.sentiment.textblob_sentiment.TextBlobSentimentAnalyser scores: programy.nlp.sentiment.scores.SentimentScores """, ConsoleConfiguration(), ".") bot_config = yaml.get_section("bot") sentiment_config = BotSentimentAnalyserConfiguration() sentiment_config.load_config_section(yaml, bot_config, ".") license_keys = LicenseKeys() sentiment_config.check_for_license_keys(license_keys) self.assertEqual( "programy.nlp.sentiment.textblob_sentiment.TextBlobSentimentAnalyser", sentiment_config.classname) self.assertEqual("programy.nlp.sentiment.scores.SentimentScores", sentiment_config.scores)
import os from programy.utils.text.text import TextUtils from programy.utils.geo.geonames import GeoNamesApi from programy.utils.license.keys import LicenseKeys if __name__ == '__main__': # Only to be used to create test data for unit aiml_tests license_keys = LicenseKeys() license_keys.load_license_key_file(os.path.dirname(__file__) + TextUtils.replace_path_seperator('/../../../../bots/y-bot/config/license.keys')) geonamesapi = GeoNamesApi(license_keys) # Running these tools drops test files into the geocode test folder geonamesapi.store_get_latlong_for_postcode_to_file("KY39UR", TextUtils.replace_path_seperator("../../../test/utils/geocode/geonames_latlong.json")) geonamesapi.store_get_latlong_for_postcode_to_file("KY39UR", TextUtils.replace_path_seperator("../../../test/utils/geo/geonames_latlong.json")) # Only to be used to create test data for unit aiml_tests
class BotClient(ResponseLogger): def __init__(self, id, argument_parser=None): self._id = id self._arguments = self.parse_arguments(argument_parser=argument_parser) self.initiate_logging(self.arguments) self._configuration = None self.load_configuration(self.arguments) self.parse_configuration() self._bot_factory = BotFactory(self, self.configuration.client_configuration) self._license_keys = LicenseKeys() self.load_license_keys() self.get_license_keys() self._scheduler = None self.load_scheduler() self._renderer = self.load_renderer() def ylogger_type(self): return "client" @property def configuration(self): return self._configuration @property def id(self): return self._id @property def arguments(self): return self._arguments @property def license_keys(self): return self._license_keys @property def scheduler(self): return self._scheduler @property def bot_factory(self): return self._bot_factory @property def renderer(self): return self._renderer def get_description(self): raise NotImplementedError("You must override this and return a client description") def add_client_arguments(self, parser=None): # Nothing to add return def parse_configuration(self): # Nothing to add return def parse_args(self, arguments, parsed_args): # Nothing to add return def parse_arguments(self, argument_parser): client_args = CommandLineClientArguments(self, parser=argument_parser) client_args.parse_args(self) return client_args def load_license_keys(self): if self.configuration is not None: if self.configuration.client_configuration.license_keys is not None: self._license_keys.load_license_key_file(self.configuration.client_configuration.license_keys) else: YLogger.warning(self, "No client configuration setting for license_keys") else: YLogger.warning(self, "No configuration defined when loading license keys") def get_license_keys(self): return def initiate_logging(self, arguments): if arguments.logging is not None: with open(arguments.logging, 'r+', encoding="utf-8") as yml_data_file: logging_config = yaml.load(yml_data_file) logging.config.dictConfig(logging_config) YLogger.info(self, "Now logging under configuration") else: print("Warning. No logging configuration file defined, using defaults...") def get_client_configuration(self): """ By overriding this class in you Configuration file, you can add new configurations and stil use the dynamic loader capabilities :return: Client configuration object """ raise NotImplementedError("You must override this and return a subclassed client configuration") def load_configuration(self, arguments): if arguments.bot_root is None: if arguments.config_filename is not None: arguments.bot_root = os.path.dirname(arguments.config_filename) else: arguments.bot_root = "." print("No bot root argument set, defaulting to [%s]" % arguments.bot_root) if arguments.config_filename is not None: self._configuration = ConfigurationFactory.load_configuration_from_file(self.get_client_configuration(), arguments.config_filename, arguments.config_format, arguments.bot_root) else: print("No configuration file specified, using defaults only !") self._configuration = ProgramyConfiguration(self.get_client_configuration()) def load_scheduler(self): if self.configuration.client_configuration.scheduler is not None: self._scheduler = ProgramyScheduler(self, self.configuration.client_configuration.scheduler) self._scheduler.start() def create_client_context(self, userid): client_context = ClientContext(self, userid) client_context.bot = self._bot_factory.select_bot() client_context.brain = client_context.bot._brain_factory.select_brain() return client_context def load_renderer(self): try: if self.get_client_configuration().renderer is not None: clazz = ClassLoader.instantiate_class(self.get_client_configuration().renderer.renderer) return clazz(self) except Exception as e: YLogger.exception(None, "Failed to load config specified renderer", e) return self.get_default_renderer() def get_default_renderer(self): return TextRenderer(self) def process_question(self, client_context, question): raise NotImplementedError("You must override this and implement the logic to create a response to the question") def render_response(self, client_context, response): raise NotImplementedError("You must override this and implement the logic to process the response by rendering using a RCS renderer") def process_response(self, client_context, response): raise NotImplementedError("You must override this and implement the logic to display the response to the user") def run(self): raise NotImplementedError("You must override this and implement the logic to run the client")
def test_load_license_keys_file(self): keys = LicenseKeys() keys.load_license_key_file(os.path.dirname(__file__)+ os.sep + "test.keys") self.assertTrue(keys.has_key('KEY1')) self.assertEquals("Key1Data", keys.get_key("KEY1")) self.assertTrue(keys.has_key('KEY2')) self.assertEquals("Key2Data", keys.get_key("KEY2")) self.assertTrue(keys.has_key('KEY3')) self.assertEquals("KEY3 Data With Spaces", keys.get_key("KEY3")) with self.assertRaises(Exception): keys.get_key("KEY5")
def test_load_license_keys_data(self): keys = LicenseKeys() keys.load_license_key_data(""" KEY1=Key1Data KEY2=Key2Data # This is a comment KEY3=KEY3 Data With Spaces This is not a key """) self.assertTrue(keys.has_key('KEY1')) self.assertEquals("Key1Data", keys.get_key("KEY1")) self.assertTrue(keys.has_key('KEY2')) self.assertEquals("Key2Data", keys.get_key("KEY2")) self.assertTrue(keys.has_key('KEY3')) self.assertEquals("KEY3 Data With Spaces", keys.get_key("KEY3")) with self.assertRaises(Exception): keys.get_key("KEY5")
def test_geonames_no_country(self): license_keys = LicenseKeys() license_keys.add_key('GEO_NAMES_ACCOUNTNAME', "DummyValue") with self.assertRaises(Exception): geonames = GeoNamesApi(license_keys)
import os from programy.utils.license.keys import LicenseKeys from programy.utils.newsapi.newsapi import NewsAPI if __name__ == '__main__': # Running these tools drops test files into the newapi test folder app_license_keys = LicenseKeys() app_license_keys.load_license_key_file(os.path.dirname(__file__) + '/../../../../bots/y-bot/config/license.keys') news_api = NewsAPI(app_license_keys) results = news_api.get_headlines(NewsAPI.BBC_NEWS) json_data = NewsAPI.to_json(results) NewsAPI.json_to_file('../../../test/utils/newsapi/newsapi.json', json_data) # Running these tools drops test files into the geocode test folder
def test_geonames_with_license_keys(self): license_keys = LicenseKeys() license_keys.add_key('GEO_NAMES_COUNTRY', "DummyValue") license_keys.add_key('GEO_NAMES_ACCOUNTNAME', "DummyValue") geonames = GeoNamesApi(license_keys)
def setUp(self): self.license_keys = LicenseKeys() self.license_keys.load_license_key_file(os.path.dirname(__file__)+"/../../../../bots/y-bot/config/license.keys")