aboutsummaryrefslogtreecommitdiffstats
path: root/community/py3-twisted/fix-test-suite-python38.patch
blob: 8d096278f65236a0eaea013db8df500435bcac93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
Fix test failures that happen due to changes in python 3.8

diff --git a/src/twisted/cred/credentials.py b/src/twisted/cred/credentials.py
index b55985b6cd..429706ccc7 100644
--- a/src/twisted/cred/credentials.py
+++ b/src/twisted/cred/credentials.py
@@ -439,7 +439,7 @@ class CramMD5Credentials(object):
 
 
     def checkPassword(self, password):
-        verify = hexlify(hmac.HMAC(password, self.challenge).digest())
+        verify = hexlify(hmac.HMAC(password, self.challenge, 'md5').digest())
         return verify == self.response
 
 
diff --git a/src/twisted/mail/_cred.py b/src/twisted/mail/_cred.py
index 9d3646948f..1be9fb2976 100644
--- a/src/twisted/mail/_cred.py
+++ b/src/twisted/mail/_cred.py
@@ -28,7 +28,7 @@ class CramMD5ClientAuthenticator:
 
 
     def challengeResponse(self, secret, chal):
-        response = hmac.HMAC(secret, chal).hexdigest().encode('ascii')
+        response = hmac.HMAC(secret, chal, 'md5').hexdigest().encode('ascii')
         return self.user + b' ' + response
 
 
diff --git a/src/twisted/mail/test/test_pop3.py b/src/twisted/mail/test/test_pop3.py
index 6eb7ecb287..a9895b192f 100644
--- a/src/twisted/mail/test/test_pop3.py
+++ b/src/twisted/mail/test/test_pop3.py
@@ -939,7 +939,7 @@ class SASLTests(unittest.TestCase):
         p.lineReceived(b"AUTH CRAM-MD5")
         chal = s.getvalue().splitlines()[-1][2:]
         chal = base64.decodestring(chal)
-        response = hmac.HMAC(b'testpassword', chal).hexdigest().encode("ascii")
+        response = hmac.HMAC(b'testpassword', chal, 'md5').hexdigest().encode("ascii")
 
         p.lineReceived(
             base64.encodestring(b'testuser ' + response).rstrip(b'\n'))
diff --git a/src/twisted/cred/test/test_cramauth.py b/src/twisted/cred/test/test_cramauth.py
index 1ee08712b6..6db48da3b1 100644
--- a/src/twisted/cred/test/test_cramauth.py
+++ b/src/twisted/cred/test/test_cramauth.py
@@ -39,7 +39,7 @@ class CramMD5CredentialsTests(TestCase):
         """
         c = CramMD5Credentials()
         chal = c.getChallenge()
-        c.response = hexlify(HMAC(b'secret', chal).digest())
+        c.response = hexlify(HMAC(b'secret', chal, 'md5').digest())
         self.assertTrue(c.checkPassword(b'secret'))
 
 
@@ -61,7 +61,7 @@ class CramMD5CredentialsTests(TestCase):
         """
         c = CramMD5Credentials()
         chal = c.getChallenge()
-        c.response = hexlify(HMAC(b'thewrongsecret', chal).digest())
+        c.response = hexlify(HMAC(b'thewrongsecret', chal, 'md5').digest())
         self.assertFalse(c.checkPassword(b'secret'))
 
 
@@ -75,7 +75,7 @@ class CramMD5CredentialsTests(TestCase):
         chal = c.getChallenge()
         c.setResponse(b" ".join(
             (b"squirrel",
-             hexlify(HMAC(b'supersecret', chal).digest()))))
+             hexlify(HMAC(b'supersecret', chal, 'md5').digest()))))
         self.assertTrue(c.checkPassword(b'supersecret'))
         self.assertEqual(c.username, b"squirrel")
 
diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py
index 6527e799c7..0c9d9b82ba 100644
--- a/src/twisted/web/test/test_http.py
+++ b/src/twisted/web/test/test_http.py
@@ -11,6 +11,7 @@ import base64
 import calendar
 import cgi
 import random
+import urllib.parse
 
 import hamcrest
 
@@ -2081,15 +2081,15 @@ Hello,
 class QueryArgumentsTests(unittest.TestCase):
     def testParseqs(self):
         self.assertEqual(
-            cgi.parse_qs(b"a=b&d=c;+=f"),
+            urllib.parse.parse_qs(b"a=b&d=c;+=f"),
             http.parse_qs(b"a=b&d=c;+=f"))
         self.assertRaises(
             ValueError, http.parse_qs, b"blah", strict_parsing=True)
         self.assertEqual(
-            cgi.parse_qs(b"a=&b=c", keep_blank_values=1),
+            urllib.parse.parse_qs(b"a=&b=c", keep_blank_values=1),
             http.parse_qs(b"a=&b=c", keep_blank_values=1))
         self.assertEqual(
-            cgi.parse_qs(b"a=&b=c"),
+            urllib.parse.parse_qs(b"a=&b=c"),
             http.parse_qs(b"a=&b=c"))
 
 
diff --git a/src/twisted/conch/test/test_ckeygen.py b/src/twisted/conch/test/test_ckeygen.py
index a8400857c7..257ec99855 100644
--- a/src/twisted/conch/test/test_ckeygen.py
+++ b/src/twisted/conch/test/test_ckeygen.py
@@ -89,13 +89,14 @@ class KeyGenTests(TestCase):
         self._testrun('rsa', '2048')
         self._testrun('rsa')
 
-
+    test_keygeneration.skip = "ckeygen binary not available"
 
     def test_runBadKeytype(self):
         filename = self.mktemp()
         with self.assertRaises(subprocess.CalledProcessError):
             subprocess.check_call(['ckeygen', '-t', 'foo', '-f', filename])
 
+    test_runBadKeytype.skip = "ckeygen binary not available"
 
 
     def test_enumrepresentation(self):
diff --git a/src/twisted/words/xish/domish.py b/src/twisted/words/xish/domish.py
index 2063c410a3..e264b11e16 100644
--- a/src/twisted/words/xish/domish.py
+++ b/src/twisted/words/xish/domish.py
@@ -807,7 +807,8 @@ class ExpatElementStream:
             qname = ('', name)
 
         # Process attributes
-        for k, v in attrs.items():
+        _attrs = dict(attrs)
+        for k, v in _attrs.items():
             if " " in k:
                 aqname = k.rsplit(" ", 1)
                 attrs[(aqname[0], aqname[1])] = v