diff --git a/ops/testing.py b/ops/testing.py index 503a1f59b..882d8b07d 100644 --- a/ops/testing.py +++ b/ops/testing.py @@ -971,8 +971,7 @@ def _emit_relation_broken(self, relation_name: str, relation_id: int, app = self._model.get_app(remote_app) self._charm.on[relation_name].relation_broken.emit(relation, app) - def add_relation_unit(self, relation_id: int, remote_unit_name: str, - data: Optional[Mapping[str, str]] = None) -> None: + def add_relation_unit(self, relation_id: int, remote_unit_name: str) -> None: """Add a new unit to a relation. This will trigger a `relation_joined` event. This would naturally be @@ -993,7 +992,6 @@ def add_relation_unit(self, relation_id: int, remote_unit_name: str, Args: relation_id: The integer relation identifier (as returned by :meth:`add_relation`). remote_unit_name: A string representing the remote unit that is being added. - data: A str:str mapping to put in the unit's databag. """ self._backend._relation_list_map[relation_id].append(remote_unit_name) # we can write remote unit data iff we are not in a hook env @@ -1027,9 +1025,6 @@ def add_relation_unit(self, relation_id: int, remote_unit_name: str, self._charm.on[relation_name].relation_joined.emit( relation, remote_unit.app, remote_unit) - if data is not None: - self.update_relation_data(relation_id, remote_unit_name, data) - def remove_relation_unit(self, relation_id: int, remote_unit_name: str) -> None: """Remove a unit from a relation. diff --git a/test/test_model.py b/test/test_model.py index 303d7b707..fba11a284 100644 --- a/test/test_model.py +++ b/test/test_model.py @@ -282,8 +282,11 @@ def test_remote_units_get_from_div_app(self): app_data={"app": "data"}, unit_data={"unit": "data"} ) - self.harness.add_relation_unit(relation_id, 'remoteapp/1', data={"some": "other"}) - self.harness.add_relation_unit(relation_id, 'remoteapp/2', data={"some": "yams"}) + self.harness.add_relation_unit(relation_id, 'remoteapp/1') + self.harness.add_relation_unit(relation_id, 'remoteapp/2') + + self.harness.update_relation_data(relation_id, "remoteapp/1", {"some": "other"}) + self.harness.update_relation_data(relation_id, "remoteapp/2", {"some": "yams"}) rel_db1 = self.ensure_relation('db1')