Repository: juju/python-libjuju
Issue: [Bug]: Regression in local refresh with resources

### Description

I have an [itest](https://github.com/canonical/cos-configuration-k8s-operator/blob/7f0b1eac9317850aee320b4f47a7f1527aaff625/tests/integration/test_upgrade_charm.py#L36) in which a charmhub charm is upgraded with a local charm.

With version 3.0.1, local refresh with resources works.
With version 3.0.3 it [does not](https://github.com/canonical/cos-configuration-k8s-operator/actions/runs/3312258644/jobs/5468723707):

```
Traceback (most recent call last):
  File "/home/runner/work/cos-configuration-k8s-operator/cos-configuration-k8s-operator/tests/integration/test_upgrade_charm.py", line 36, in test_build_and_deploy
    await ops_test.model.applications[app_name].refresh(path=charm_under_test, resources=resources)
  File "/home/runner/work/cos-configuration-k8s-operator/cos-configuration-k8s-operator/.tox/integration/lib/python3.8/site-packages/juju/application.py", line 641, in refresh
    raise NotImplementedError("resources option is not implemented")
NotImplementedError: resources option is not implemented
```

This regression was likely introduced by #729 or #742.

For now, pinning to 3.0.1.

### Urgency

Annoying bug in our test suite

### Python-libjuju version

3.0.3

### Juju version

2.9.35

### Reproduce / Test

```python
https://github.com/canonical/cos-configuration-k8s-operator/blob/7f0b1eac9317850aee320b4f47a7f1527aaff625/tests/integration/test_upgrade_charm.py#L36
```


Changed files:
juju/application.py, tests/integration/test_application.py

diff --git a/juju/application.py b/juju/application.py
index 65f55a2..6a95e0b 100644
--- a/juju/application.py
+++ b/juju/application.py
@@ -637,14 +637,11 @@ class Application(model.ModelEntity):
         :param str switch: Crossgrade charm url
 
         """
-        if resources is not None:
-            raise NotImplementedError("resources option is not implemented")
 
         if switch is not None and revision is not None:
             raise ValueError("switch and revision are mutually exclusive")
 
         app_facade = self._facade()
-        resources_facade = client.ResourcesFacade.from_connection(self.connection)
         charms_facade = client.CharmsFacade.from_connection(self.connection)
 
         # 1 - Figure out the destination origin and destination charm_url
@@ -664,6 +661,9 @@ class Application(model.ModelEntity):
                                      force_units, path, resources)
             return
 
+        if resources is not None:
+            raise NotImplementedError("resources option is not implemented")
+
         parsed_url = URL.parse(charm_url)
         charm_name = parsed_url.name
 
@@ -731,6 +731,7 @@ class Application(model.ModelEntity):
         # Already prepped the charm_resources
         # Now get the existing resources from the ResourcesFacade
         request_data = [client.Entity(self.tag)]
+        resources_facade = client.ResourcesFacade.from_connection(self.connection)
         response = await resources_facade.ListResources(entities=request_data)
         existing_resources = {
             resource.name: resource
diff --git a/tests/integration/test_application.py b/tests/integration/test_application.py
index 7425844..6240d80 100644
--- a/tests/integration/test_application.py
+++ b/tests/integration/test_application.py
@@ -264,6 +264,26 @@ async def test_upgrade_local_charm(event_loop):
         assert app.data['charm-url'] == 'local:focal/ubuntu-0'
 
 
+@base.bootstrapped
+@pytest.mark.asyncio
+async def test_upgrade_local_charm_resource(event_loop):
+    async with base.CleanModel() as model:
+        tests_dir = Path(__file__).absolute().parent
+        charm_path = tests_dir / 'file-resource-charm'
+        resources = {"file-res": "test.file"}
+
+        app = await model.deploy(str(charm_path), resources=resources)
+        assert 'file-resource-charm' in model.applications
+        await model.wait_for_idle()
+        assert app.units[0].agent_status == 'idle'
+
+        await app.upgrade_charm(path=charm_path, resources=resources)
+        await model.wait_for_idle()
+        ress = await app.get_resources()
+        assert 'file-res' in ress
+        assert ress['file-res']
+
+
 @base.bootstrapped
 @pytest.mark.asyncio
 @pytest.mark.skip('Update charm')