def test__post(self): # Arrange bot = EverywordBot("consumer_key", "consumer_secret", "access_token", "token_secret", "test/test_source.txt", "test/test_index.txt") bot.twitter.update_status = stub_twitter_update_status index_before = bot._get_current_index() # Act bot.post() # Assert index_after = bot._get_current_index() self.assertEqual(index_before + 1, index_after)
def test__post(self): # Arrange bot = EverywordBot("consumer_key", "consumer_secret", "access_token", "token_secret", "test/test_source.txt", "test/test_index.txt") stub = TwitterStub() bot.twitter.update_status = stub.twitter_update_status index_before = bot._get_current_index() # Act bot.post() # Assert index_after = bot._get_current_index() self.assertEqual(index_before + 1, index_after)
def test__get_current_index_file_not_exist(self): # Arrange bot = EverywordBot("consumer_key", "consumer_secret", "access_token", "token_secret", "_source_file", "no_index_file") # Act index = bot._get_current_index() # Assert self.assertEqual(index, 0)
def test__increment_index(self): # Arrange bot = EverywordBot("consumer_key", "consumer_secret", "access_token", "token_secret", "_source_file", "test/test_index.txt") # Act bot._increment_index(0) # Assert index = bot._get_current_index() self.assertEqual(index, 1)