Example #1
0
def post_entities(request):
    existing_entity = entity.get_by_external_id(
        request.data.get('external_id'))
    if existing_entity is None:
        return create_full_entity(request)
    else:
        return update_existing_entity(existing_entity, request)
Example #2
0
 def test_get_by_external_id(self):
     an_entity = EntityFactory(external_id="1234567")
     self.assertEqual(entity.get_by_external_id("1234567"), an_entity)
     self.assertEqual(entity.get_by_external_id("321"), None)
Example #3
0
 def test_get_by_external_id(self):
     self.assertEqual(entity.get_by_external_id("1234567"), self.an_entity)
     self.assertEqual(entity.get_by_external_id("321"), None)