Exemplo n.º 1
0
    def test_run_calls_pytest(self):
        """This should just return from pytest.main()"""

        with patch("tavern.core.pytest.main") as pmock:
            run("abc")

        assert pmock.called
Exemplo n.º 2
0
    def test_normal_args(self):
        with patch("tavern.core.pytest.main") as pmock:
            run(**{
                'tavern_global_cfg': None,
                'in_file': "kfdoskdof",
                'tavern_http_backend': 'requests',
                'tavern_mqtt_backend': 'paho-mqtt',
                'tavern_strict': True,
            })

        assert pmock.called
Exemplo n.º 3
0
    def test_normal_args(self):
        with patch("tavern.core.pytest.main") as pmock:
            run(
                **{
                    "tavern_global_cfg": None,
                    "in_file": "kfdoskdof",
                    "tavern_http_backend": "requests",
                    "tavern_mqtt_backend": "paho-mqtt",
                    "tavern_strict": True,
                })

        assert pmock.called
Exemplo n.º 4
0
    def test_extra_args(self):
        with pytest.warns(FutureWarning):
            with patch("tavern.core.pytest.main") as pmock:
                run(**{
                    'tavern_global_cfg': None,
                    'in_file': "kfdoskdof",
                    'tavern_http_backend': 'requests',
                    'tavern_mqtt_backend': 'paho-mqtt',
                    'tavern_strict': True,
                    'gfg': '2efsf',
                })

        assert pmock.called
Exemplo n.º 5
0
    def test_extra_args(self):
        with pytest.raises(TypeError):
            with patch("tavern.core.pytest.main") as pmock:
                run(
                    **{
                        "tavern_global_cfg": None,
                        "in_file": "kfdoskdof",
                        "tavern_http_backend": "requests",
                        "tavern_mqtt_backend": "paho-mqtt",
                        "tavern_strict": True,
                        "gfg": "2efsf",
                    })

        assert not pmock.called
Exemplo n.º 6
0
def pytest_tavern_beta_before_every_test_run(test_dict, variables):
    run("test_deleteAll.tavern.yaml")
Exemplo n.º 7
0
from tavern.core import run

run('.')


def pytest_tavern_beta_before_every_test_run(test_dict, variables):
    run("test_deleteAll.tavern.yaml")
Exemplo n.º 8
0
"""
Project's entry-point
"""
import logging.config
import os
import json
import yaml

from tavern.core import run

token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1MzI4MDU4MjYsIm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Carrega os JWTs(app and user)
os.environ.update({
    "APP_TOKEN": token,
    "USER_TOKEN": token,
    "USER_TOKEN_NO_AUTH": token,
    "URL_API": "https://protokol-api.onyxapis.com"
})

with open("tests/logging.yaml", "r") as spec_file:
    settings = yaml.load(spec_file)
    logging.config.dictConfig(settings)

test_info = run('tests/main.tavern.yaml')
pass
print(json.dumps(test_info))

exit(int(test_info['all_passed'] is False))
Exemplo n.º 9
0
from tavern.core import run
from subprocess import Popen, PIPE

#process = Popen(['python','server.py'],stdout=PIPE,stderr=PIPE)
print('spawned server')

success = run("test.tavern.yaml",{})
Exemplo n.º 10
0
 def test_run_with_empty_cfg(self):
     run("", {})
Exemplo n.º 11
0
 def test_warns_about_extra_kwargs(self):
     with pytest.warns(FutureWarning):
         run("", a=123)
Exemplo n.º 12
0
 def test_bad_type(self):
     with pytest.raises(exceptions.InvalidSettingsError):
         run("", tavern_global_cfg=["a", "b", "c"])
Exemplo n.º 13
0
# It runs all tests.

from tavern.core import run

failure = run('tests-broadcast_raw.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-node0_coordinator.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-node0_leds.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-node0_os.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-node0_sfrc.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-node0_dfrc.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-daemon_cfg-meta-on.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-node0_sfrc-meta.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-daemon_cfg-meta-off.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-node1_explore.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-node1_iqmesh.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-node1_sensor.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-node2_bo.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-node2_iqmesh.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-node2_sensor.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-node3_light.tavern.yaml', pytest_args=["-x"])
failure |= run('tests-node4_dali.tavern.yaml', pytest_args=["-x"])

if failure:
    print("Error running tests.")
Exemplo n.º 14
0
 def test_path_nonexistent(self):
     with pytest.raises(exceptions.InvalidSettingsError):
         run("", tavern_global_cfg="sdfsdd")
Exemplo n.º 15
0
 def test_pass_dict(self):
     run("", tavern_global_cfg={"variables": {"a": 1}})
Exemplo n.º 16
0
 def test_path_correct(self):
     run("", tavern_global_cfg=__file__)
Exemplo n.º 17
0
def test_conf(list_config):
    for _ in list_config:
        success = run(in_file="test.tavern.yaml", tavern_global_cfg=_)

        if not success:
            print("Error running tests")
from tavern.core import run

success = run("test_simple.tavern.yaml", {})

if not success:
    print("Error running tests")
Exemplo n.º 19
0
 def test_run_with_cfg(self):
     run("", {"a": 2})
Exemplo n.º 20
0
    def test_doesnt_warn_about_expected_kwargs(self, expected_kwarg):
        kw = {expected_kwarg: 123}
        with pytest.warns(None) as warn_rec:
            run("", **kw)

        assert not len(warn_rec)
Exemplo n.º 21
0
 def test_run(self):
     run("")
Exemplo n.º 22
0
from tavern.core import run
from glob import glob

for test in glob("test_*.yaml"):
    run(test)