def testCreate(self): """Creating an object works! """ o = Object() self.db.add_resp(201, 'application/json', '{"id": "9d4", "URI": "https"}') o.create() self.assert_(o.uid) self.assertEqual(self.last, ( 'POST', '/objects', {}, None, None))
def get_object(uuid=None, about=None): """ Returns the referenced object or a new object if uuid or about are not given. """ logger.info("Getting object") if uuid: logger.info("Object with uuid %r" % uuid) return Object(uid=uuid) elif about: logger.info("Object with about tag value: %r" % about) return Object(about=about) else: o = Object() o.create() logger.info("New object with uuid %r" % o.uid) return o