Remove unnecessary json.dumps from tests (#13303)

This commit is contained in:
Dirk Klimpel 2022-07-17 23:28:45 +02:00 committed by GitHub
parent 5d4028f217
commit efee345b45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 143 additions and 200 deletions

View file

@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import json
from unittest.mock import Mock
from twisted.test.proto_helpers import MemoryReactorClock
@ -51,7 +50,7 @@ class TermsTestCase(unittest.HomeserverTestCase):
def test_ui_auth(self):
# Do a UI auth request
request_data = json.dumps({"username": "kermit", "password": "monkey"})
request_data = {"username": "kermit", "password": "monkey"}
channel = self.make_request(b"POST", self.url, request_data)
self.assertEqual(channel.result["code"], b"401", channel.result)
@ -82,16 +81,14 @@ class TermsTestCase(unittest.HomeserverTestCase):
self.assertDictContainsSubset(channel.json_body["params"], expected_params)
# We have to complete the dummy auth stage before completing the terms stage
request_data = json.dumps(
{
"username": "kermit",
"password": "monkey",
"auth": {
"session": channel.json_body["session"],
"type": "m.login.dummy",
},
}
)
request_data = {
"username": "kermit",
"password": "monkey",
"auth": {
"session": channel.json_body["session"],
"type": "m.login.dummy",
},
}
self.registration_handler.check_username = Mock(return_value=True)
@ -102,16 +99,14 @@ class TermsTestCase(unittest.HomeserverTestCase):
self.assertEqual(channel.result["code"], b"401", channel.result)
# Finish the UI auth for terms
request_data = json.dumps(
{
"username": "kermit",
"password": "monkey",
"auth": {
"session": channel.json_body["session"],
"type": "m.login.terms",
},
}
)
request_data = {
"username": "kermit",
"password": "monkey",
"auth": {
"session": channel.json_body["session"],
"type": "m.login.terms",
},
}
channel = self.make_request(b"POST", self.url, request_data)
# We're interested in getting a response that looks like a successful