| Total Complexity | 2 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | #!/usr/bin/env python3 |
||
| 2 | # -*- coding: utf-8 -*- |
||
| 3 | """ |
||
| 4 | Created on Mon Oct 7 12:37:21 2019 |
||
| 5 | |||
| 6 | @author: Paolo Cozzi <[email protected]> |
||
| 7 | """ |
||
| 8 | |||
| 9 | from unittest.mock import patch |
||
| 10 | |||
| 11 | from django.test import TestCase |
||
| 12 | |||
| 13 | |||
| 14 | from ..tasks import clearsessions, cleanupregistration |
||
| 15 | |||
| 16 | |||
| 17 | class TestClearSession(TestCase): |
||
| 18 | @patch('django.core.management.call_command') |
||
| 19 | def test_clearsession(self, my_patch): |
||
| 20 | result = clearsessions.run() |
||
| 21 | |||
| 22 | self.assertEqual(result, "Sessions cleaned with success") |
||
| 23 | self.assertTrue(my_patch.called) |
||
| 24 | |||
| 25 | |||
| 26 | class TestCleanUpRegistration(TestCase): |
||
| 27 | @patch('django.core.management.call_command') |
||
| 28 | def test_cleanupregistration(self, my_patch): |
||
| 29 | result = cleanupregistration.run() |
||
| 30 | |||
| 31 | self.assertEqual(result, "Registrations cleaned with success") |
||
| 32 | self.assertTrue(my_patch.called) |
||
| 33 |