Skip to content

Unit tests currently fail

Found 93 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
............................................F................................................
======================================================================
FAIL: test_expense_type_map (reimbursements.tests.test_models.TestRequestType.test_expense_type_map)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/srv/reimbursements/local/src/reimbursements/tests/test_models.py", line 49, in test_expense_type_map
    self.assertEqual(
AssertionError: defaultdict(<class 'list'>, {45: [49, 50], 46: [50]}) != {49: [45, 50], 46: [50]}

It's this test:

class TestRequestType(TestCase):
    def test_expense_type_map(self):
        travel = RequestType.objects.create(name="Travel")
        hardware = RequestType.objects.create(name="Hardware")
        accomm = ExpenseType.objects.create(name="Accommodation")
        accomm.request_types.set([travel])
        other = ExpenseType.objects.create(name="Other")
        other.request_types.set([travel, hardware])
        self.assertEqual(
            RequestType.expense_type_map(),
            {
                accomm.id: [travel.id, other.id],
                hardware.id: [other.id],
            },
        )