def test_get_networking_information_from_vagrant_queries_returns_dict(self):
        ret = get_networking_information_from_vagrant(
            '/tmp/some/vagrant/checkout'
        )

        expected_information = {
            'HostName': self.run_local_command.return_value.strip.return_value,
            'Port': self.run_local_command.return_value.strip.return_value,
            'IdentityFile': self.run_local_command.return_value.strip.return_value,
        }
        self.assertEqual(ret, expected_information)
Пример #2
0
    def test_get_networking_information_from_vagrant_queries_vagrant_ssh_config(
            self):
        get_networking_information_from_vagrant('/tmp/some/vagrant/checkout')

        expected_calls = [
            call(
                "cd /tmp/some/vagrant/checkout && vagrant ssh-config "
                "| grep HostName | awk '{print $NF}'",
                shell=True),
            call(
                "cd /tmp/some/vagrant/checkout && vagrant ssh-config "
                "| grep Port | awk '{print $NF}'",
                shell=True),
            call(
                "cd /tmp/some/vagrant/checkout && vagrant ssh-config "
                "| grep IdentityFile | awk '{print $NF}'",
                shell=True),
        ]
        for expected_call in expected_calls:
            self.assertIn(expected_call, self.run_local_command.mock_calls)
Пример #3
0
    def test_get_networking_information_from_vagrant_queries_returns_dict(
            self):
        ret = get_networking_information_from_vagrant(
            '/tmp/some/vagrant/checkout')

        expected_information = {
            'HostName': self.run_local_command.return_value.strip.return_value,
            'Port': self.run_local_command.return_value.strip.return_value,
            'IdentityFile':
            self.run_local_command.return_value.strip.return_value,
        }
        self.assertEqual(ret, expected_information)
    def test_get_networking_information_from_vagrant_queries_vagrant_ssh_config(self):
        get_networking_information_from_vagrant('/tmp/some/vagrant/checkout')

        expected_calls = [
            call(
                "cd /tmp/some/vagrant/checkout && vagrant ssh-config "
                "| grep HostName | awk '{print $NF}'",
                shell=True
            ),
            call(
                "cd /tmp/some/vagrant/checkout && vagrant ssh-config "
                "| grep Port | awk '{print $NF}'",
                shell=True
            ),
            call(
                "cd /tmp/some/vagrant/checkout && vagrant ssh-config "
                "| grep IdentityFile | awk '{print $NF}'",
                shell=True
            ),
        ]
        for expected_call in expected_calls:
            self.assertIn(expected_call, self.run_local_command.mock_calls)