From ac7491680be699a4aa2920efcfc6eba45493c6ab Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Sat, 5 Dec 2020 09:06:45 -0500
Subject: [PATCH] fix unicode/bytes stuff in the affected tests

---
 src/allmydata/scripts/common.py       | 4 +++-
 src/allmydata/test/test_introducer.py | 8 ++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/allmydata/scripts/common.py b/src/allmydata/scripts/common.py
index b20cca65f..29bb1d5f1 100644
--- a/src/allmydata/scripts/common.py
+++ b/src/allmydata/scripts/common.py
@@ -121,11 +121,13 @@ def write_introducer(basedir, petname, furl):
     Overwrite the node's ``introducers.yaml`` with a file containing the given
     introducer information.
     """
+    if isinstance(furl, bytes):
+        furl = furl.decode("utf-8")
     basedir.child(b"private").child(b"introducers.yaml").setContent(
         safe_dump({
             "introducers": {
                 petname: {
-                    "furl": furl.decode("ascii"),
+                    "furl": furl,
                 },
             },
         }).encode("ascii"),
diff --git a/src/allmydata/test/test_introducer.py b/src/allmydata/test/test_introducer.py
index 3aed3f049..2c5354fe0 100644
--- a/src/allmydata/test/test_introducer.py
+++ b/src/allmydata/test/test_introducer.py
@@ -818,8 +818,8 @@ class Announcements(AsyncTestCase):
         # until the introducer connection is established). To avoid getting
         # confused by this, disable storage.
         with basedir.child("tahoe.cfg").open("w") as f:
-            f.write("[storage]\n")
-            f.write("enabled = false\n")
+            f.write(b"[storage]\n")
+            f.write(b"enabled = false\n")
 
         c = yield create_client(basedir.path)
         ic = c.introducer_clients[0]
@@ -906,8 +906,8 @@ class ClientSeqnums(AsyncBrokenTestCase):
         # until the introducer connection is established). To avoid getting
         # confused by this, disable storage.
         with basedir.child("tahoe.cfg").open("w") as f:
-            f.write("[storage]\n")
-            f.write("enabled = false\n")
+            f.write(b"[storage]\n")
+            f.write(b"enabled = false\n")
 
         c = yield create_client(basedir.path)
         ic = c.introducer_clients[0]