def testRunSimpleValue(self): c = DomainGetCommand() c.params.partner = PartnerAuthInfo(None) c.params.name = 'testVALUE' def checkResults(_): self.assertEqual(c.result.repr, '33') self.assertEqual(c.result.classname, 'int') self.assertEqual(c.result.interfaces, []) return c.run().addCallback(checkResults)
def testRunObjectValue(self): c = DomainGetCommand() c.params.partner = PartnerAuthInfo(None) c.params.name = 'testOBJECT' def checkResults(_): self.assertEqual(c.result.repr, 'testing object representation') self.assertEqual(c.result.classname, 'TestObject') self.assertEqual(c.result.interfaces, ['I2', 'I1']) return c.run().addCallback(checkResults)
def testRunNonexistent(self): c = DomainGetCommand() c.params.partner = PartnerAuthInfo(None) c.params.name = 'NONEXISTENT' return c.run().addCallback(lambda _: self.assert_(False)).addErrback(lambda failure: failure.trap("spamfighter.core.commands.errors.AttributeKeyException"))