fixing test_route

This commit is contained in:
Cayo Puigdefabregas 2021-02-08 18:47:16 +01:00
parent 2497d31c49
commit 550c4db74e
1 changed files with 4 additions and 4 deletions

View File

@ -17,7 +17,7 @@ class RouterTests(BaseTestCase):
def test_get_instances(self): def test_get_instances(self):
class TestBackend(backends.ServiceController): class ServiceBackend(backends.ServiceController):
verbose_name = 'Route' verbose_name = 'Route'
models = ['routes.Route'] models = ['routes.Route']
@ -26,14 +26,14 @@ class RouterTests(BaseTestCase):
choices = backends.ServiceBackend.get_choices() choices = backends.ServiceBackend.get_choices()
Route._meta.get_field('backend').choices = choices Route._meta.get_field('backend').choices = choices
backend = TestBackend.get_name() backend = ServiceBackend.get_name()
route = Route.objects.create(backend=backend, host=self.host, match='True') route = Route.objects.create(backend=backend, host=self.host, match='True')
operation = Operation(backend=TestBackend, instance=route, action='save') operation = Operation(backend=ServiceBackend, instance=route, action='save')
self.assertEqual(1, len(Route.objects.get_for_operation(operation))) self.assertEqual(1, len(Route.objects.get_for_operation(operation)))
route = Route.objects.create(backend=backend, host=self.host1, route = Route.objects.create(backend=backend, host=self.host1,
match='route.backend == "%s"' % TestBackend.get_name()) match='route.backend == "%s"' % ServiceBackend.get_name())
self.assertEqual(2, len(Route.objects.get_for_operation(operation))) self.assertEqual(2, len(Route.objects.get_for_operation(operation)))
route = Route.objects.create(backend=backend, host=self.host2, route = Route.objects.create(backend=backend, host=self.host2,