Пример #1
0
    def test_return_none(self, ssh):
        """get_server_version returns None.

        When the versions.rb file is not present.
        """
        ssh.command = mock.MagicMock(return_value=FakeSSHResult([], 0))
        self.assertEqual(get_server_version(), None)
Пример #2
0
    def test_return_version(self, ssh):
        """get_server_version returns a proper version.

        When the version.rb file is present.
        """
        ssh.command = mock.MagicMock(return_value=FakeSSHResult(['"6.1.4"'], 0))
        assert get_server_version() == '6.1.4'
Пример #3
0
    def test_return_none(self, ssh):
        """get_server_version returns None.

        When the versions.rb file is not present.
        """
        ssh.command = mock.MagicMock(return_value=FakeSSHResult(
            [],
            0
        ))
        self.assertEqual(get_server_version(), None)
Пример #4
0
    def test_return_version(self, ssh):
        """get_server_version returns a proper version.

        When the version.rb file is present.
        """
        ssh.command = mock.MagicMock(return_value=FakeSSHResult(
            ['"6.1.4"'],
            0
        ))
        self.assertEqual(get_server_version(), '6.1.4')