def setUp(self): config = Config(BOT_CONFIG, section='niconico') self.user_id = config.get_value('user_id') self.pass_word = config.get_value('pass_word') with TwitterBot(BOT_CONFIG) as bot: bot.create_database() self.prev_datetime = datetime.datetime.now() self.prev_datetime = self.prev_datetime - datetime.timedelta(7)
class ConfigTest(unittest.TestCase): def setUp(self): print() self.config = Config(SAMPLE_BOT_CONFIG) def test_simple(self): self.assertEquals(SAMPLE_BOT_CONFIG, (self.config.config_file)) self.assertEquals('consumer_key', self.config.get_value('consumer_key', section='twitter')) self.assertEquals('consumer_secret', self.config.get_value('consumer_secret', section='twitter')) self.assertEquals('access_token', self.config.get_value('access_token', section='twitter')) self.assertEquals('access_token_secret', self.config.get_value('access_token_secret', section='twitter')) self.assertEquals('xxxx@yyyy', self.config.get_value('user_id', section='niconico')) self.assertEquals('pass_word', self.config.get_value('pass_word', section='niconico')) self.assertEquals('developer_key', self.config.get_value('developer_key', section='youtube'))