SEBA-394 Fix bug with reverse cache no populated
Change-Id: I51b0570b691aab67620cabc24f0e10ba73706488
diff --git a/VERSION b/VERSION
index b88e1c8..f1592fa 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.1.27
+2.1.28
diff --git a/containers/chameleon/Dockerfile.chameleon b/containers/chameleon/Dockerfile.chameleon
index 4708590..b9aa657 100644
--- a/containers/chameleon/Dockerfile.chameleon
+++ b/containers/chameleon/Dockerfile.chameleon
@@ -13,7 +13,7 @@
# limitations under the License.
# xosproject/chameleon
-FROM xosproject/xos-base:2.1.27
+FROM xosproject/xos-base:2.1.28
# xos-base already has protoc and dependencies installed
diff --git a/containers/xos/Dockerfile.client b/containers/xos/Dockerfile.client
index 2ba7abd..902bc4b 100644
--- a/containers/xos/Dockerfile.client
+++ b/containers/xos/Dockerfile.client
@@ -13,7 +13,7 @@
# limitations under the License.
# xosproject/xos-client
-FROM xosproject/xos-libraries:2.1.27
+FROM xosproject/xos-libraries:2.1.28
# Install XOS client
COPY xos/xos_client /tmp/xos_client
diff --git a/containers/xos/Dockerfile.libraries b/containers/xos/Dockerfile.libraries
index 85a6085..f9ee238 100644
--- a/containers/xos/Dockerfile.libraries
+++ b/containers/xos/Dockerfile.libraries
@@ -13,7 +13,7 @@
# limitations under the License.
# xosproject/xos-libraries
-FROM xosproject/xos-base:2.1.27
+FROM xosproject/xos-base:2.1.28
# Add libraries
COPY lib /opt/xos/lib
diff --git a/containers/xos/Dockerfile.synchronizer-base b/containers/xos/Dockerfile.synchronizer-base
index b4879ca..7329a5d 100644
--- a/containers/xos/Dockerfile.synchronizer-base
+++ b/containers/xos/Dockerfile.synchronizer-base
@@ -13,7 +13,7 @@
# limitations under the License.
# xosproject/xos-synchronizer-base
-FROM xosproject/xos-client:2.1.27
+FROM xosproject/xos-client:2.1.28
COPY xos/synchronizers/new_base /opt/xos/synchronizers/new_base
COPY xos/xos/logger.py /opt/xos/xos/logger.py
diff --git a/containers/xos/Dockerfile.xos-core b/containers/xos/Dockerfile.xos-core
index 8bb2e66..02fd1a3 100644
--- a/containers/xos/Dockerfile.xos-core
+++ b/containers/xos/Dockerfile.xos-core
@@ -13,7 +13,7 @@
# limitations under the License.
# xosproject/xos-core
-FROM xosproject/xos-libraries:2.1.27
+FROM xosproject/xos-libraries:2.1.28
# Install XOS
ADD xos /opt/xos
diff --git a/xos/xos_client/xosapi/orm.py b/xos/xos_client/xosapi/orm.py
index 6e3e5f4..07144f5 100644
--- a/xos/xos_client/xosapi/orm.py
+++ b/xos/xos_client/xosapi/orm.py
@@ -218,9 +218,9 @@
def reverse_fk_resolve(self, name):
if name not in self.reverse_cache:
fk_entry = self._reverse_fkmap[name]
- self.cache[name] = ORMLocalObjectManager(self.stub, fk_entry["modelName"], getattr(self, fk_entry["src_fieldName"]), fk_entry["writeable"])
+ self.reverse_cache[name] = ORMLocalObjectManager(self.stub, fk_entry["modelName"], getattr(self, fk_entry["src_fieldName"]), fk_entry["writeable"])
- return self.cache[name]
+ return self.reverse_cache[name]
def fk_set(self, name, model):
fk_entry = self._fkmap[name]
diff --git a/xos/xos_client/xosapi/test_orm.py b/xos/xos_client/xosapi/test_orm.py
index 07c26fc..2f4593b 100644
--- a/xos/xos_client/xosapi/test_orm.py
+++ b/xos/xos_client/xosapi/test_orm.py
@@ -689,6 +689,9 @@
testModel_resolved = testModelTwo.fk_resolve("testmodel")
self.assertEqual(testModel_resolved.id, testModel.id)
+ # the cache should have been populated
+ self.assertIn(("testmodel", testModel_resolved), testModelTwo.cache.items())
+
def test_ORMWrapper_reverse_fk_resolve(self):
""" If a TestModelTwo has a relation to TestModel, then TestModel's reverse_fk should be resolvable to a list
of TestModelTwo objects.
@@ -708,6 +711,9 @@
testModelTwos_resolved = testModel.reverse_fk_resolve("testmodeltwos")
self.assertEqual(testModelTwos_resolved.count(), 1)
+ # the reverse_cache should have been populated
+ self.assertIn(("testmodeltwos", testModelTwos_resolved), testModel.reverse_cache.items())
+
def test_ORMWrapper_fk_set(self):
""" fk_set will set the testmodel field on TesTModelTwo to point to the TestModel. """