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)
예제 #2
0
    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)
예제 #3
0
    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)
예제 #4
0
    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)
예제 #5
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)
예제 #6
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)