mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 14:04:55 -04:00
Use literals in place of HTTPStatus
constants in tests (#13488)
* Use literals in place of `HTTPStatus` constants in tests * newsfile * code style * code style
This commit is contained in:
parent
51c01d450a
commit
2281427175
12 changed files with 177 additions and 447 deletions
|
@ -11,9 +11,6 @@
|
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from http import HTTPStatus
|
||||
|
||||
from twisted.test.proto_helpers import MemoryReactor
|
||||
|
||||
import synapse.rest.admin
|
||||
|
@ -40,7 +37,7 @@ class UsernameAvailableTestCase(unittest.HomeserverTestCase):
|
|||
if username == "allowed":
|
||||
return True
|
||||
raise SynapseError(
|
||||
HTTPStatus.BAD_REQUEST,
|
||||
400,
|
||||
"User ID already taken.",
|
||||
errcode=Codes.USER_IN_USE,
|
||||
)
|
||||
|
@ -67,10 +64,6 @@ class UsernameAvailableTestCase(unittest.HomeserverTestCase):
|
|||
url = "%s?username=%s" % (self.url, "disallowed")
|
||||
channel = self.make_request("GET", url, access_token=self.admin_user_tok)
|
||||
|
||||
self.assertEqual(
|
||||
HTTPStatus.BAD_REQUEST,
|
||||
channel.code,
|
||||
msg=channel.json_body,
|
||||
)
|
||||
self.assertEqual(400, channel.code, msg=channel.json_body)
|
||||
self.assertEqual(channel.json_body["errcode"], "M_USER_IN_USE")
|
||||
self.assertEqual(channel.json_body["error"], "User ID already taken.")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue