aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2023-07-12 09:43:26 +1200
committerTom Ryder <tom@sanctum.geek.nz>2023-07-12 12:42:31 +1200
commit6fa8e0e67352d75a85aaf6dd70c06621210d59d5 (patch)
treef66f78bc12596f62739158392fe8c10d0a3a6fe4
parentAdd test suite (diff)
downloadssh_negotiate_term-6fa8e0e67352d75a85aaf6dd70c06621210d59d5.tar.gz
ssh_negotiate_term-6fa8e0e67352d75a85aaf6dd70c06621210d59d5.zip
Run test.py through autopep8
-rw-r--r--test.py53
1 files changed, 41 insertions, 12 deletions
diff --git a/test.py b/test.py
index 7a784be..0e929ed 100644
--- a/test.py
+++ b/test.py
@@ -4,6 +4,7 @@ import unittest
from ssh_negotiate_term import SSHNegotiateTerm
+
class TestSSHNegotiateTerm(unittest.TestCase):
def setUp(self):
@@ -19,25 +20,45 @@ class TestSSHNegotiateTerm(unittest.TestCase):
self.assertIsInstance(snt, SSHNegotiateTerm)
def test_hostname(self):
- snt = SSHNegotiateTerm('screen-256color', ['ssh', 'examplehost'], self.snt_config)
+ snt = SSHNegotiateTerm(
+ 'screen-256color', ['ssh', 'examplehost'], self.snt_config)
self.assertEqual(snt.term, 'screen-256color')
def test_fqdn(self):
- snt = SSHNegotiateTerm('screen-256color', ['ssh', 'host.example.net.'], self.snt_config)
+ snt = SSHNegotiateTerm(
+ 'screen-256color', ['ssh', 'host.example.net.'], self.snt_config)
self.assertEqual(snt.term, 'screen-256color')
def test_ipv4(self):
- snt = SSHNegotiateTerm('screen-256color', ['ssh', '192.0.2.1'], self.snt_config)
+ snt = SSHNegotiateTerm(
+ 'screen-256color', ['ssh', '192.0.2.1'], self.snt_config)
self.assertEqual(snt.term, 'screen')
def test_ipv6(self):
- snt = SSHNegotiateTerm('screen-256color', ['ssh', '2001:0db8::1'], self.snt_config)
+ snt = SSHNegotiateTerm(
+ 'screen-256color', ['ssh', '2001:0db8::1'], self.snt_config)
self.assertEqual(snt.term, 'screen')
def test_complex_command_line(self):
- snt = SSHNegotiateTerm('screen-256color', ['ssh', '-4', '-NfoSetEnv=FOO=BAR', '-NtT', '--', '192.0.2.1', 'runcmd'], self.snt_config)
+ snt = SSHNegotiateTerm('screen-256color',
+ ['ssh',
+ '-4',
+ '-NfoSetEnv=FOO=BAR',
+ '-NtT',
+ '--',
+ '192.0.2.1',
+ 'runcmd'],
+ self.snt_config)
self.assertEqual(snt.term, 'screen')
- snt = SSHNegotiateTerm('screen-256color', ['ssh', '-4', '-NfoSetEnv=FOO=BAR', '-NtT', '--', 'examplehost', 'runcmd'], self.snt_config)
+ snt = SSHNegotiateTerm('screen-256color',
+ ['ssh',
+ '-4',
+ '-NfoSetEnv=FOO=BAR',
+ '-NtT',
+ '--',
+ 'examplehost',
+ 'runcmd'],
+ self.snt_config)
self.assertEqual(snt.term, 'screen-256color')
def test_null_term(self):
@@ -45,7 +66,9 @@ class TestSSHNegotiateTerm(unittest.TestCase):
self.assertEqual(snt.term, None)
def test_unknown_term(self):
- snt = SSHNegotiateTerm('qwyjibo', ['ssh', '192.0.2.1'], self.snt_config)
+ snt = SSHNegotiateTerm(
+ 'qwyjibo', [
+ 'ssh', '192.0.2.1'], self.snt_config)
self.assertEqual(snt.term, 'qwyjibo')
def test_untranslated_term(self):
@@ -55,24 +78,30 @@ class TestSSHNegotiateTerm(unittest.TestCase):
def test_patterns_simple(self):
config = self.snt_config
self.snt_config['patterns']['examplehost'] = '^examplehost$'
- snt = SSHNegotiateTerm('screen-256color', ['ssh', 'examplehost'], self.snt_config)
+ snt = SSHNegotiateTerm(
+ 'screen-256color', ['ssh', 'examplehost'], self.snt_config)
self.assertEqual(snt.term, 'screen')
- snt = SSHNegotiateTerm('screen-256color', ['ssh', 'examplehost2'], self.snt_config)
+ snt = SSHNegotiateTerm(
+ 'screen-256color', ['ssh', 'examplehost2'], self.snt_config)
self.assertEqual(snt.term, 'screen-256color')
def test_pattern_complex(self):
config = self.snt_config
self.snt_config['patterns']['complexhost'] = '^[a-z]{3}-[a-z]{2,}-[a-z]{2,}-[0-9]'
- snt = SSHNegotiateTerm('screen-256color', ['ssh', 'abc-example-ar-1'], self.snt_config)
+ snt = SSHNegotiateTerm(
+ 'screen-256color', ['ssh', 'abc-example-ar-1'], self.snt_config)
self.assertEqual(snt.term, 'screen')
- snt = SSHNegotiateTerm('screen-256color', ['ssh', 'abc-example-ar-a1'], self.snt_config)
+ snt = SSHNegotiateTerm(
+ 'screen-256color', ['ssh', 'abc-example-ar-a1'], self.snt_config)
self.assertEqual(snt.term, 'screen-256color')
def test_translations(self):
for outer in self.snt_config['translations']:
- snt = SSHNegotiateTerm(outer, ['ssh', '192.0.2.1'], self.snt_config)
+ snt = SSHNegotiateTerm(
+ outer, ['ssh', '192.0.2.1'], self.snt_config)
inner = self.snt_config['translations'][outer]
self.assertEqual(snt.term, inner)
+
if __name__ == '__main__':
unittest.main()