Ver código fonte

Update client integration tests

Updates client integration tests to work with pytest-salt-factories.
Also update xfails to handle newer pytest.
Barney Sowood 1 ano atrás
pai
commit
96484be110
1 arquivos alterados com 13 adições e 13 exclusões
  1. 13 13
      tests/integration/test_clients.py

+ 13 - 13
tests/integration/test_clients.py

@@ -1,8 +1,7 @@
 # -*- coding: utf-8 -*-
 import json
-import os
+import pathlib
 import pytest
-import sys
 
 
 def test_local_bad_opts(pepper_cli):
@@ -17,7 +16,7 @@ def test_local_bad_opts(pepper_cli):
 
 
 @pytest.mark.xfail(
-    pytest.config.getoption("--salt-api-backend") == "rest_tornado",
+    'config.getoption("--salt-api-backend") == "rest_tornado"',
     reason="timeout kwarg isnt popped until next version of salt/tornado"
 )
 def test_runner_client(pepper_cli):
@@ -30,34 +29,35 @@ def test_runner_client(pepper_cli):
 
 
 @pytest.mark.xfail(
-    pytest.config.getoption("--salt-api-backend") == "rest_tornado",
+    'config.getoption("--salt-api-backend") == "rest_tornado"',
     reason="wheelClient unimplemented for now on tornado",
 )
-def test_wheel_client_arg(pepper_cli, session_minion_id):
+def test_wheel_client_arg(pepper_cli, session_minion):
     ret = pepper_cli('--client=wheel', 'minions.connected')
-    assert ret == ['pytest-session-salt-minion-0']
+    assert ret == [session_minion.id]
 
 
 @pytest.mark.xfail(
-    pytest.config.getoption("--salt-api-backend") == "rest_tornado",
+    'config.getoption("--salt-api-backend") == "rest_tornado"',
     reason="wheelClient unimplemented for now on tornado",
 )
-def test_wheel_client_kwargs(pepper_cli, session_master_config_file):
+def test_wheel_client_kwargs(pepper_cli, session_master):
     ret = pepper_cli(
         '--client=wheel', 'config.update_config', 'file_name=pepper',
         'yaml_contents={0}'.format(json.dumps({"timeout": 5})),
     )
     assert ret == 'Wrote pepper.conf'
-    assert os.path.isfile('{0}.d/pepper.conf'.format(session_master_config_file))
+
+    default_include_dir = pathlib.Path(session_master.config['default_include']).parent
+    pepper_config = (pathlib.Path(session_master.config_dir) / default_include_dir / 'pepper.conf')
+    assert pepper_config.exists
 
 
 @pytest.mark.xfail(
-    pytest.config.getoption("--salt-api-backend") == "rest_tornado",
+    'config.getoption("--salt-api-backend") == "rest_tornado"',
     reason="sshClient unimplemented for now on tornado",
 )
-@pytest.mark.xfail(sys.version_info >= (3, 0),
-                   reason='Broken with python3 right now')
-def test_ssh_client(pepper_cli, session_roster_config, session_roster_config_file):
+def test_ssh_client(pepper_cli, session_ssh_roster_config):
     ret = pepper_cli('--client=ssh', '*', 'test.ping')
     assert ret['ssh']['localhost']['return'] is True