def test_route_args(self): self.session = DummySession(version='3.1') resource = self.resourceCls(session=self.session, watcher=None) self.assertTrue(hasattr(resource, self.route_compatible.get_route_name())) route_instance = resource.routecompatible self.assertEqual(route_instance.name, "Route Compatible 3.1") self.assertEqual(route_instance.httpMethod, Route.POST) self.assertEqual(route_instance.path, "/route/compatible/v1")
def test_route_convert(self): self.session = DummySession(version='3.2') resource = self.resourceCls(session=self.session, watcher=None) self.assertTrue(hasattr(resource, self.route_compatible.get_route_name())) route_instance = resource.routecompatible self.assertEqual(route_instance.name, "Route Compatible 3.0") self.assertEqual(route_instance.httpMethod, Route.GET) self.assertEqual(route_instance.path, "/route/compatible/{route_ID}") res = route_instance(json=1) self.assertDictEqual(res, {'httpMethod': 'GET', 'path': 'route/compatible/0', 'json': 1})
def test_route_removed(self): self.session = DummySession(version='3.3') resource = self.resourceCls(session=self.session, watcher=None) self.assertFalse(hasattr(resource, self.route_compatible.get_route_name()))
def test_resource_removed(self): self.session = DummySession(version='4.0') self.create_resources(self, [self.resourceCls], None) self.assertFalse(hasattr(self, self.resourceCls.__name__), 'Obsolete Resources should not be created')
def test_resource_created(self): self.session = DummySession(version='1.0') self.create_resources(self, [self.resourceCls], None) self.assertTrue(hasattr(self, self.resourceCls.__name__), 'Available Resources should be created')
def test_resource_not_available(self): self.session = DummySession(version='0.0') self.create_resources(self, [self.resourceCls], None) self.assertFalse(hasattr(self, self.resourceCls.__name__), 'Future Resources should not be created')