Exemplo n.º 1
0
 def test_non_interactive(self, *mock):
     PurgeRequest().handle(amount=1, duration='days', interactive=False)
     self.assertFalse(mock[0].called)
     self.assertEqual(1, Request.objects.count())
Exemplo n.º 2
0
 def test_no_request_to_delete(self, mock_stdout):
     Request.objects.all().delete()
     PurgeRequest().handle(amount=1, duration='day', interactive=False)
     self.assertIn('There are no requests to delete.',
                   mock_stdout.getvalue())
Exemplo n.º 3
0
 def test_interactive_non_confirmed(self, mock_stdout, mock_input):
     PurgeRequest().handle(amount=1, duration='days', interactive=True)
     self.assertTrue(mock_input.called)
     self.assertEqual(2, Request.objects.count())
     self.assertEqual('Purge cancelled\n', mock_stdout.getvalue())
Exemplo n.º 4
0
 def test_invalid_duration(self, *mock):
     with self.assertRaises(CommandError):
         PurgeRequest().handle(amount=1, duration='foo')
     self.assertEqual(2, Request.objects.count())
Exemplo n.º 5
0
 def test_duration_without_s(self, *mock):
     PurgeRequest().handle(amount=1, duration='day')
     self.assertEqual(1, Request.objects.count())
Exemplo n.º 6
0
 def test_purge_requests(self, *mock):
     PurgeRequest().handle(amount=1, duration='days')
     self.assertEqual(1, Request.objects.count())
Exemplo n.º 7
0
 def test_interactive_non_confirmed(self, *mock):
     PurgeRequest().handle(amount=1, duration='days', interactive=True)
     self.assertTrue(mock[0].called)
     self.assertEqual(2, Request.objects.count())
Exemplo n.º 8
0
 def test_no_request_to_delete(self, *mock):
     PurgeRequest().handle(amount=1, duration='days')