예제 #1
0
 def test_indexed_09(self):
     """Index tweets"""
     with managed_io() as (out):
         UserInterface(['', self.work_dir])
     console = str(out.getvalue().strip())
     self.assertTrue(console.endswith('Cheers!'))
     self.assertTrue('5 tweets to read' in console)
예제 #2
0
 def test_ctrlc(self):
     """Start app, quit with ctrl-C"""
     with managed_io() as (out):
         UserInterface(['', self.work_dir])
     console = str(out.getvalue().strip())
     self.assertTrue(console.endswith('Cheers!'))
     self.assertTrue('Aborted.' in console)
예제 #3
0
 def test_search_foo(self):
     """Find the first tweet"""
     with managed_io() as (out):
         UserInterface(['', self.work_dir])
     console = str(out.getvalue().strip())
     #print(console)
     self.assertTrue(console.endswith('Cheers!'))
     self.assertTrue('Having 2 tweets' in console)
예제 #4
0
 def test_twitter_auth(self):
     """Start app, authenticate Twitter api, quit"""
     with managed_io() as (out):
         UserInterface(
             ['', self.work_dir, '{}/testauth.yml'.format(self.work_dir)])
     console = str(out.getvalue().strip())
     self.assertTrue(console.endswith('Cheers!'))
     self.assertTrue('Authenticated' in console)
     self.assertTrue('Quit.' in console)
예제 #5
0
 def test_all_read_and_kill(self):
     """Browse archive and kill all"""
     with managed_io() as (out):
         UserInterface(['', self.work_dir])
     console = str(out.getvalue().strip())
     self.assertTrue(console.endswith('Cheers!'))
     self.assertTrue('unread .....: 0' in console)
     self.assertTrue('read .......: 6' in console)
     self.assertTrue('keeping ....: 0' in console)
     self.assertTrue('to destroy .: 1' in console)
예제 #6
0
 def test_destroy_safe(self):
     """Don't destroy kept tweets"""
     with managed_io() as (out):
         UserInterface(['', self.work_dir])
     console = str(out.getvalue().strip())
     self.assertTrue(console.endswith('Cheers!'))
     self.assertTrue('2 tweets marked to DESTROY' in console)
     self.assertTrue('DESTROYING' in console)
     self.assertFalse('2020-09-18 22222' in console)
     self.assertTrue('2020-09-18 33333' in console)
     self.assertTrue('to destroy .: 1' in console)
     self.assertTrue('destroyed ..: 1' in console)
예제 #7
0
 def test_all_no_filter_quit(self):
     """Browse archive, no filters"""
     with managed_io() as (out):
         UserInterface(['', self.work_dir])
     console = str(out.getvalue().strip())
     self.assertTrue(console.endswith('Cheers!'))
     self.assertTrue('FAKE CLEAR SCREEN' in console)
     self.assertTrue('Having 6 tweets to read' in console)
     self.assertTrue('Filter out already read tweets?' in console)
     self.assertTrue('Filter out retweets?' in console)
     self.assertTrue('Filter out replies?' in console)
     self.assertTrue('Filter out tweets?' in console)
     self.assertTrue('Still 6 tweets' in console)
예제 #8
0
 def test_username(self):
     """Start app, enter username, quit"""
     with managed_io() as (out):
         UserInterface(['', self.work_dir])
     console = str(out.getvalue().strip())
     self.assertTrue(console.endswith('Cheers!'))
     self.assertTrue('Please enter your Twitter username:'******'s tweet archive" in console)
     self.assertTrue('in archive .: 6' in console)
     self.assertTrue('unread .....: 6' in console)
     self.assertTrue('read .......: 0' in console)
     self.assertTrue('keeping ....: 0' in console)
     self.assertTrue('to destroy .: 0' in console)
     self.assertTrue('Quit.' in console)
예제 #9
0
 def test_all_mix(self):
     """Read all tweets and apply actions"""
     with managed_io() as (out):
         UserInterface(['', self.work_dir])
     console = str(out.getvalue().strip())
     self.assertTrue(console.endswith('Cheers!'))
     self.assertTrue('in archive .: 6' in console)
     self.assertTrue('unread .....: 6' in console)
     self.assertTrue('unread .....: 5' in console)
     self.assertTrue('unread .....: 4' in console)
     self.assertTrue('unread .....: 3' in console)
     self.assertTrue('read .......: 0' in console)
     self.assertTrue('read .......: 1' in console)
     self.assertTrue('read .......: 2' in console)
     self.assertTrue('read .......: 3' in console)
     self.assertTrue('keeping ....: 1' in console)
     self.assertTrue('to destroy .: 2' in console)
     self.assertTrue('Having 6 tweets' in console)
     self.assertTrue('Still 3 tweets' in console)
예제 #10
0
 def test_all_no_filter_abort(self):
     """Browse archive, no filters"""
     with managed_io() as (out):
         UserInterface(['', self.work_dir])
     console = str(out.getvalue().strip())
     self.assertTrue(console.endswith('Cheers!'))
예제 #11
0
 def test_usage_hint(self):
     """User must get a hint about usage"""
     with managed_io() as (out):
         UserInterface([''])
     console = str(out.getvalue().strip())
     self.assertTrue('Usage:' in console)