Пример #1
0
    def test_do_tweet_long(self):
        """Testing tweeting a test tweet that is over 280 characters"""
        tweet_location = False
        variable_location = False
        content = 'This tweet is over 280 characters.\n' \
                  'This tweet is over 280 characters.\n' \
                  'This tweet is over 280 characters.\n' \
                  'This tweet is over 280 characters.\n' \
                  'This tweet is over 280 characters.\n' \
                  'This tweet is over 280 characters.\n' \
                  'This tweet is over 280 characters.\n' \
                  'This tweet is over 280 characters.\n' \
                  'This tweet is over 280 characters.\n' \
                  'This tweet is over 280 characters.'
        hashtag = '#testing'
        status = weatherBot.do_tweet(content, self.location, tweet_location, variable_location, hashtag=hashtag)
        expected_text = 'This tweet is over 280 characters. ' \
                        'This tweet is over 280 characters. ' \
                        'This tweet is over 280 characters. ' \
                        'This tweet is over 280 characters. ' \
                        'This tweet is over 280 characters. ' \
                        'This tweet is over 280 characters. ' \
                        'This tweet is over 280 characters. ' \
                        'This tweet is over 280… #testing'

        self.assertEqual(status.text, expected_text)
Пример #2
0
 def test_do_tweet_error(self):
     """Testing tweeting a test tweet that should throw and error using keys from env variables"""
     tweet_location = False
     variable_location = False
     content = 'error'
     status = weatherBot.do_tweet(content, self.location, tweet_location, variable_location)
     self.assertEqual(None, status)
Пример #3
0
 def test_do_tweet_with_locations(self):
     """Testing tweeting a test tweet with location and variable location"""
     tweet_location = True
     variable_location = True
     content = 'Just running unit tests, this should disappear...'
     weatherBot.CONFIG['basic']['hashtag'] = ''
     tweet_content = self.location.name + ': ' + content
     status = weatherBot.do_tweet(content, self.location, tweet_location, variable_location)
     self.assertEqual(status.text, tweet_content)
Пример #4
0
 def test_do_tweet(self):
     """Testing tweeting a test tweet"""
     tweet_location = False
     variable_location = False
     content = 'Just running unit tests, this should disappear...'
     hashtag = '#testing'
     tweet_content = content + ' ' + hashtag
     status = weatherBot.do_tweet(content, self.location, tweet_location, variable_location, hashtag=hashtag)
     self.assertEqual(status.text, tweet_content)
Пример #5
0
 def test_do_tweet_error(self):
     """Testing tweeting a test tweet that should throw and error using keys from env variables"""
     tweet_location = False
     variable_location = False
     content = 'This tweet is over 140 characters.\n' \
               'This tweet is over 140 characters.\n' \
               'This tweet is over 140 characters.\n' \
               'This tweet is over 140 characters.\n' \
               'This tweet is over 140 characters.\n' \
               '{0}'.format(random.randint(0, 9999))
     status = weatherBot.do_tweet(content, self.location, tweet_location, variable_location)
     self.assertEqual(None, status)
Пример #6
0
 def test_do_tweet_with_locations(self):
     """Testing tweeting a test tweet with location and variable location using keys from env variables"""
     tweet_location = True
     variable_location = True
     content = 'Just running unit tests, this should disappear... {0}'.format(random.randint(0, 9999))
     weatherBot.CONFIG['basic']['hashtag'] = ''
     tweet_content = self.location.name + ': ' + content
     status = weatherBot.do_tweet(content, self.location, tweet_location, variable_location)
     self.assertEqual(status.text, tweet_content)
     # test destroy
     api = weatherBot.get_tweepy_api()
     deleted = api.destroy_status(id=status.id)
     self.assertEqual(deleted.id, status.id)
Пример #7
0
 def test_do_tweet(self):
     """Testing tweeting a test tweet using keys from env variables"""
     tweet_location = False
     variable_location = False
     content = 'Just running unit tests, this should disappear... {0}'.format(random.randint(0, 9999))
     hashtag = '#testing'
     tweet_content = content + ' ' + hashtag
     status = weatherBot.do_tweet(content, self.location, tweet_location, variable_location, hashtag=hashtag)
     self.assertEqual(status.text, tweet_content)
     # test destroy
     api = weatherBot.get_tweepy_api()
     deleted = api.destroy_status(id=status.id)
     self.assertEqual(deleted.id, status.id)