Beispiel #1
0
 def test_review(self, sup):
     args = {'--review': True}
     sup.create_review_file.return_value = 'FOO'
     cli.execute_args(args)
     today = datetime.now().date()
     sup.create_review_file.assert_called_with(today)
     sup.open_file.assert_called_with(filepath='FOO')
Beispiel #2
0
 def test_update_by_last(self, sup):
     args = {'--update': True, '--last': True}
     prev_date = datetime(2018, 10, 10)
     today = datetime.now().date()
     sup.find_last_date.return_value = prev_date
     cli.execute_args(args)
     sup.create_update.assert_called_with(prev_date, today)
Beispiel #3
0
 def test_iteration(self, sup):
     args = {'--iteration': 7}
     sup.create_file.return_value = 'FOO'
     cli.execute_args(args)
     today = datetime.now().date()
     sup.create_file.assert_called_with(today, i=7)
     sup.open_file.assert_called_with(filepath='FOO')
Beispiel #4
0
 def test_tomorrow(self, sup):
     args = {'--tomorrow': True}
     cli.execute_args(args)
     today = datetime.now().date()
     tomm = today + timedelta(days=1)
     sup.create_file.assert_called_with(tomm)
     sup.open_file.assert_called_with(tomm)
Beispiel #5
0
 def test_update_by_date(self, sup):
     args = {
         '--update': True,
         '--date': '2018-10-10',
     }
     cli.execute_args(args)
     target = datetime(2018, 10, 10), datetime.now().date()
     sup.create_update.assert_called_with(*target)
Beispiel #6
0
 def test_yesterday(self, sup):
     args = {'--yesterday': True}
     cli.execute_args(args)
     today = datetime.now().date()
     yesterday = today - timedelta(days=1)
     sup.open_file.assert_called_with(yesterday)
Beispiel #7
0
 def test_last(self, sup):
     args = {'--last': True}
     prev_date = datetime(2018, 10, 10)
     sup.find_last_date.return_value = prev_date
     cli.execute_args(args)
     sup.open_file.assert_called_with(prev_date)
Beispiel #8
0
 def test_date(self, sup):
     args = {'--date': '2018-10-10'}
     cli.execute_args(args)
     sup.create_file.assert_called_with(datetime(2018, 10, 10))
Beispiel #9
0
 def test_print_by_default(self, sup):
     args = {'--print': True}
     cli.execute_args(args)
     sup.print_sup.assert_called_with(datetime.now().date())
Beispiel #10
0
 def test_print_by_date(self, sup):
     args = {'--print': True, '--date': '2018-10-10'}
     cli.execute_args(args)
     sup.print_sup.assert_called_with(datetime(2018, 10, 10))
Beispiel #11
0
 def test_update_by_default(self, sup):
     args = {'--update': True}
     cli.execute_args(args)
     today = datetime.now().date()
     prev_date = today - timedelta(days=1)
     sup.create_update.assert_called_with(prev_date, today)
Beispiel #12
0
 def test_default(self, sup):
     args = {}
     cli.execute_args(args)
     today = datetime.now().date()
     sup.create_file.assert_called_with(today)
     sup.open_file.assert_called_with(today)
Beispiel #13
0
 def test_dir(self):
     args = {'--dir': True}
     cli.execute_args(args)
     ok_(True)