How to use get_vendor method in avocado

Best Python code snippet using avocado_python

test_ssh_transport.py

Source: test_ssh_transport.py Github

copy

Full Screen

...34 manager = TestSSHVendorManager()35 self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})36 vendor = object()37 manager.register_vendor("vendor", vendor)38 self.assertIs(manager.get_vendor({"BZR_SSH": "vendor"}), vendor)39 def test_default_vendor(self):40 manager = TestSSHVendorManager()41 self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})42 vendor = object()43 manager.register_default_vendor(vendor)44 self.assertIs(manager.get_vendor({}), vendor)45 def test_get_vendor_by_environment(self):46 manager = TestSSHVendorManager()47 self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})48 self.assertRaises(UnknownSSH,49 manager.get_vendor, {"BZR_SSH": "vendor"})50 vendor = object()51 manager.register_vendor("vendor", vendor)52 self.assertIs(manager.get_vendor({"BZR_SSH": "vendor"}), vendor)53 def test_get_vendor_by_inspection_openssh(self):54 manager = TestSSHVendorManager()55 self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})56 manager.set_ssh_version_string("OpenSSH")57 self.assertIsInstance(manager.get_vendor({}), OpenSSHSubprocessVendor)58 def test_get_vendor_by_inspection_sshcorp(self):59 manager = TestSSHVendorManager()60 self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})61 manager.set_ssh_version_string("SSH Secure Shell")62 self.assertIsInstance(manager.get_vendor({}), SSHCorpSubprocessVendor)63 def test_get_vendor_by_inspection_lsh(self):64 manager = TestSSHVendorManager()65 self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})66 manager.set_ssh_version_string("lsh")67 self.assertIsInstance(manager.get_vendor({}), LSHSubprocessVendor)68 def test_get_vendor_by_inspection_plink(self):69 manager = TestSSHVendorManager()70 self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})71 manager.set_ssh_version_string("plink")72 # Auto-detect of plink vendor disabled, on Windows recommended73 # default ssh-client is paramiko74 # see https:/​/​bugs.launchpad.net/​bugs/​41474375 #~self.assertIsInstance(manager.get_vendor({}), PLinkSubprocessVendor)76 self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})77 def test_cached_vendor(self):78 manager = TestSSHVendorManager()79 self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})80 vendor = object()81 manager.register_vendor("vendor", vendor)82 self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})83 # Once the vendor is found the result is cached (mainly because of the84 # 'get_vendor' sometimes can be an expensive operation) and later85 # invocations of the 'get_vendor' just returns the cached value.86 self.assertIs(manager.get_vendor({"BZR_SSH": "vendor"}), vendor)87 self.assertIs(manager.get_vendor({}), vendor)88 # The cache can be cleared by the 'clear_cache' method89 manager.clear_cache()90 self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})91 def test_get_vendor_search_order(self):92 # The 'get_vendor' method search for SSH vendors as following:93 #94 # 1. Check previously cached value95 # 2. Check BZR_SSH environment variable96 # 3. Check the system for known SSH vendors97 # 4. Fall back to the default vendor if registered98 #99 # Let's now check the each check method in the reverse order100 # clearing the cache between each invocation:101 manager = TestSSHVendorManager()102 # At first no vendors are found103 self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})104 # If the default vendor is registered it will be returned105 default_vendor = object()106 manager.register_default_vendor(default_vendor)107 self.assertIs(manager.get_vendor({}), default_vendor)108 # If the known vendor is found in the system it will be returned109 manager.clear_cache()110 manager.set_ssh_version_string("OpenSSH")111 self.assertIsInstance(manager.get_vendor({}), OpenSSHSubprocessVendor)112 # If the BZR_SSH environment variable is found it will be treated as113 # the vendor name114 manager.clear_cache()115 vendor = object()116 manager.register_vendor("vendor", vendor)117 self.assertIs(manager.get_vendor({"BZR_SSH": "vendor"}), vendor)118 # Last cached value always checked first119 self.assertIs(manager.get_vendor({}), vendor)120 def test_get_vendor_from_path_win32_plink(self):121 manager = TestSSHVendorManager()122 manager.set_ssh_version_string("plink: Release 0.60")123 plink_path = "C:/​Program Files/​PuTTY/​plink.exe"124 vendor = manager.get_vendor({"BZR_SSH": plink_path})125 self.assertIsInstance(vendor, PLinkSubprocessVendor)126 args = vendor._get_vendor_specific_argv("user", "host", 22, ["bzr"])127 self.assertEqual(args[0], plink_path)128 def test_get_vendor_from_path_nix_openssh(self):129 manager = TestSSHVendorManager()130 manager.set_ssh_version_string(131 "OpenSSH_5.1p1 Debian-5, OpenSSL, 0.9.8g 19 Oct 2007")132 openssh_path = "/​usr/​bin/​ssh"133 vendor = manager.get_vendor({"BZR_SSH": openssh_path})134 self.assertIsInstance(vendor, OpenSSHSubprocessVendor)135 args = vendor._get_vendor_specific_argv("user", "host", 22, ["bzr"])136 self.assertEqual(args[0], openssh_path)137class SubprocessVendorsTests(TestCase):138 def test_openssh_command_tricked(self):139 vendor = OpenSSHSubprocessVendor()140 self.assertEqual(141 vendor._get_vendor_specific_argv(142 "user", "-oProxyCommand=blah", 100, command=["bzr"]),143 ["ssh", "-oForwardX11=no", "-oForwardAgent=no",144 "-oClearAllForwardings=yes",145 "-oNoHostAuthenticationForLocalhost=yes",146 "-p", "100",147 "-l", "user",...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Nov’22 Updates: Live With Automation Testing On OTT Streaming Devices, Test On Samsung Galaxy Z Fold4, Galaxy Z Flip4, & More

Hola Testers! Hope you all had a great Thanksgiving weekend! To make this time more memorable, we at LambdaTest have something to offer you as a token of appreciation.

Considering Agile Principles from a different angle

In addition to the four values, the Agile Manifesto contains twelve principles that are used as guides for all methodologies included under the Agile movement, such as XP, Scrum, and Kanban.

How To Choose The Best JavaScript Unit Testing Frameworks

JavaScript is one of the most widely used programming languages. This popularity invites a lot of JavaScript development and testing frameworks to ease the process of working with it. As a result, numerous JavaScript testing frameworks can be used to perform unit testing.

How To Write End-To-End Tests Using Cypress App Actions

When I started writing tests with Cypress, I was always going to use the user interface to interact and change the application’s state when running tests.

[LambdaTest Spartans Panel Discussion]: What Changed For Testing & QA Community And What Lies Ahead

The rapid shift in the use of technology has impacted testing and quality assurance significantly, especially around the cloud adoption of agile development methodologies. With this, the increasing importance of quality and automation testing has risen enough to deliver quality work.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful