We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6622313 commit 0322ac7Copy full SHA for 0322ac7
1 file changed
tests/test_authcode.py
@@ -0,0 +1,23 @@
1
+import unittest
2
+
3
+from oauth2cli.authcode import AuthCodeReceiver
4
5
6
+class TestAuthCodeReceiver(unittest.TestCase):
7
+ def test_setup_at_a_given_port_and_teardown(self):
8
+ port = 12345 # Assuming this port is available
9
+ with AuthCodeReceiver(port=port) as receiver:
10
+ self.assertEqual(port, receiver.get_port())
11
12
+ def test_setup_at_a_ephemeral_port_and_teardown(self):
13
+ port = 0
14
15
+ self.assertNotEqual(port, receiver.get_port())
16
17
+ def test_no_two_concurrent_receivers_can_listen_on_same_port(self):
18
19
20
+ with self.assertRaises(OSError):
21
+ with AuthCodeReceiver(port=port) as receiver2:
22
+ pass
23
0 commit comments