Repository: getmoto/moto
Pull request #6359 (2023-06-01 22:58:18)

Bump software.amazon.awssdk:bom from 2.20.56 to 2.20.77 in /other_langs/tests_java
Bumps software.amazon.awssdk:bom from 2.20.56 to 2.20.77.


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=software.amazon.awssdk:bom&package-manager=maven&previous-version=2.20.56&new-version=2.20.77)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/getmoto/moto/pull/6359?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) Report
> Merging [#6359](https://app.codecov.io/gh/getmoto/moto/pull/6359?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (ef43040) into [master](https://app.codecov.io/gh/getmoto/moto/commit/37cb6cee94ffe294e7d02c7d252bcfb252179177?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (37cb6ce) will **increase** coverage by `0.00%`.
> The diff coverage is `n/a`.

```diff
@@           Coverage Diff           @@
##           master    #6359   +/-   ##
=======================================
  Coverage   96.16%   96.16%           
=======================================
  Files         794      794           
  Lines       77544    77544           
=======================================
+ Hits        74570    74573    +3     
+ Misses       2974     2971    -3     
```

| Flag | Coverage Δ | |
|---|---|---|
| servertests | `36.89% <ø> (ø)` | |
| unittests | `96.11% <ø> (+<0.01%)` | :arrow_up: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#carryforward-flags-in-the-pull-request-comment) to find out more.

[see 1 file with indirect coverage changes](https://app.codecov.io/gh/getmoto/moto/pull/6359/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)



Patch:
diff --git a/moto/sns/models.py b/moto/sns/models.py
index a4a0ff719..e252af984 100644
--- a/moto/sns/models.py
+++ b/moto/sns/models.py
@@ -493,7 +493,7 @@ class SNSBackend(BaseBackend):
     def get_topic(self, arn: str) -> Topic:
         parsed_arn = parse_arn(arn)
         try:
-            return sns_backends[parsed_arn.account][parsed_arn.region].topics[arn]
+            return sns_backends[parsed_arn.account][self.region_name].topics[arn]
         except KeyError:
             raise TopicNotFound
 


Test patch:
diff --git a/other_langs/tests_java/pom.xml b/other_langs/tests_java/pom.xml
index 12ca2b26c..8aa19be90 100644
--- a/other_langs/tests_java/pom.xml
+++ b/other_langs/tests_java/pom.xml
@@ -22,7 +22,7 @@
     <dependency>
       <groupId>software.amazon.awssdk</groupId>
       <artifactId>bom</artifactId>
-      <version>2.20.56</version>
+      <version>2.20.77</version>
       <type>pom</type>
       <scope>import</scope>
     </dependency>
@@ -104,7 +104,7 @@
         </plugin>
         <plugin>
           <artifactId>maven-project-info-reports-plugin</artifactId>
-          <version>3.4.3</version>
+          <version>3.4.4</version>
         </plugin>
       </plugins>
     </pluginManagement>
diff --git a/tests/test_sns/test_topics_boto3.py b/tests/test_sns/test_topics_boto3.py
index 922909882..964b724fc 100644
--- a/tests/test_sns/test_topics_boto3.py
+++ b/tests/test_sns/test_topics_boto3.py
@@ -1,7 +1,8 @@
 import boto3
 import json
+import pytest
 
-# import sure  # noqa # pylint: disable=unused-import
+import sure  # noqa # pylint: disable=unused-import
 
 from botocore.exceptions import ClientError
 from moto import mock_sns
@@ -131,9 +132,23 @@ def test_create_topic_should_be_of_certain_length():
 def test_create_topic_in_multiple_regions():
     for region in ["us-west-1", "us-west-2"]:
         conn = boto3.client("sns", region_name=region)
-        conn.create_topic(Name="some-topic")
+        topic_arn = conn.create_topic(Name="some-topic")["TopicArn"]
+        # We can find the topic
         list(conn.list_topics()["Topics"]).should.have.length_of(1)
 
+        # We can read the Topic details
+        topic = boto3.resource("sns", region_name=region).Topic(topic_arn)
+        topic.load()
+
+    # Topic does not exist in different region though
+    with pytest.raises(ClientError) as exc:
+        sns_resource = boto3.resource("sns", region_name="eu-north-1")
+        topic = sns_resource.Topic(topic_arn)
+        topic.load()
+    err = exc.value.response["Error"]
+    assert err["Code"] == "NotFound"
+    assert err["Message"] == "Topic does not exist"
+
 
 @mock_sns
 def test_topic_corresponds_to_region():