OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
python3
/
dist-packages
/
twisted
/
words
/
test
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
03/31/2022 06:22:39 AM
rwxr-xr-x
📄
__init__.py
14 bytes
09/08/2017 10:38:36 AM
rw-r--r--
📁
__pycache__
-
03/31/2022 06:22:40 AM
rwxr-xr-x
📄
test_basechat.py
2.45 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_basesupport.py
2.99 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_domish.py
19.7 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_irc.py
100.97 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_irc_service.py
9.41 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_ircsupport.py
10.45 KB
09/08/2017 10:38:35 AM
rw-r--r--
📄
test_jabberclient.py
16.47 KB
03/22/2022 11:03:56 AM
rw-r--r--
📄
test_jabbercomponent.py
13.87 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_jabbererror.py
11.25 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_jabberjid.py
7.04 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_jabberjstrports.py
996 bytes
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_jabbersasl.py
9.21 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_jabbersaslmechanisms.py
5.62 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_jabberxmlstream.py
44.65 KB
03/22/2022 11:03:56 AM
rw-r--r--
📄
test_jabberxmppstringprep.py
5.42 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_service.py
27.79 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_tap.py
2.13 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_xishutil.py
9.18 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_xmlstream.py
6.13 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_xmpproutertap.py
2.34 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
test_xpath.py
10.74 KB
09/08/2017 10:38:36 AM
rw-r--r--
Editing: test_tap.py
Close
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from twisted.cred import credentials, error from twisted.words import tap from twisted.trial import unittest class WordsTapTests(unittest.TestCase): """ Ensures that the twisted.words.tap API works. """ PASSWD_TEXT = b"admin:admin\njoe:foo\n" admin = credentials.UsernamePassword(b'admin', b'admin') joeWrong = credentials.UsernamePassword(b'joe', b'bar') def setUp(self): """ Create a file with two users. """ self.filename = self.mktemp() self.file = open(self.filename, 'wb') self.file.write(self.PASSWD_TEXT) self.file.flush() def tearDown(self): """ Close the dummy user database. """ self.file.close() def test_hostname(self): """ Tests that the --hostname parameter gets passed to Options. """ opt = tap.Options() opt.parseOptions(['--hostname', 'myhost']) self.assertEqual(opt['hostname'], 'myhost') def test_passwd(self): """ Tests the --passwd command for backwards-compatibility. """ opt = tap.Options() opt.parseOptions(['--passwd', self.file.name]) self._loginTest(opt) def test_auth(self): """ Tests that the --auth command generates a checker. """ opt = tap.Options() opt.parseOptions(['--auth', 'file:'+self.file.name]) self._loginTest(opt) def _loginTest(self, opt): """ This method executes both positive and negative authentication tests against whatever credentials checker has been stored in the Options class. @param opt: An instance of L{tap.Options}. """ self.assertEqual(len(opt['credCheckers']), 1) checker = opt['credCheckers'][0] self.assertFailure(checker.requestAvatarId(self.joeWrong), error.UnauthorizedLogin) def _gotAvatar(username): self.assertEqual(username, self.admin.username) return checker.requestAvatarId(self.admin).addCallback(_gotAvatar)