def test_client_supports(self): self.assertTrue(caps.client_supports(self.client_caps, NS_PING), msg="Assume supported, if we don't have caps") self.assertFalse(caps.client_supports(self.client_caps, NS_XHTML_IM), msg="Must not assume blacklisted feature is supported on default") self.cc.initialize_from_db() self.assertFalse(caps.client_supports(self.client_caps, NS_PING), msg="Must return false on unsupported feature") self.assertTrue(caps.client_supports(self.client_caps, NS_XHTML_IM), msg="Must return True on supported feature") self.assertTrue(caps.client_supports(self.client_caps, NS_MUC), msg="Must return True on supported feature")
def test_client_supports(self): self.assertTrue(caps.client_supports(self.client_caps, NS_PING), msg="Assume supported, if we don't have caps") self.assertFalse( caps.client_supports(self.client_caps, NS_XHTML_IM), msg="Must not assume blacklisted feature is supported on default") self.cc.initialize_from_db() self.assertFalse(caps.client_supports(self.client_caps, NS_PING), msg="Must return false on unsupported feature") self.assertTrue(caps.client_supports(self.client_caps, NS_XHTML_IM), msg="Must return True on supported feature") self.assertTrue(caps.client_supports(self.client_caps, NS_MUC), msg="Must return True on supported feature")
def supports(self, requested_feature): """ Return True if the contact has advertised to support the feature identified by the given namespace. False otherwise. """ if self.show == "offline": # Unfortunately, if all resources are offline, the contact # includes the last resource that was online. Check for its # show, so we can be sure it's existant. Otherwise, we still # return caps for a contact that has no resources left. return False else: return caps_cache.client_supports(self.client_caps, requested_feature)
def supports(self, requested_feature): """ Return True if the contact has advertised to support the feature identified by the given namespace. False otherwise. """ if self.show == 'offline': # Unfortunately, if all resources are offline, the contact # includes the last resource that was online. Check for its # show, so we can be sure it's existant. Otherwise, we still # return caps for a contact that has no resources left. return False else: return caps_cache.client_supports(self.client_caps, requested_feature)