repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_hide_utils.py | test_skip_when_body_is_none | assert | none_literal | 21 | import requests
from pytest import fixture, mark
from scanapi.hide_utils import _hide, _override_info, hide_sensitive_info
def response(requests_mock):
requests_mock.get("http://test.com", text="data")
return requests.get("http://test.com")
class TestOverrideInfo:
@mark.it("should skip when body is None... | None | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_hide_utils.py | test_overrides_body_and_empty_content | assert | string_literal | 22 | import requests
from pytest import fixture, mark
from scanapi.hide_utils import _hide, _override_info, hide_sensitive_info
def response(requests_mock):
requests_mock.get("http://test.com", text="data")
return requests.get("http://test.com")
class TestOverrideInfo:
@mark.it("should overrides body and emp... | b"{}" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_hide_utils.py | test_calls__hide | assert_* | variable | 53 | import requests
from pytest import fixture, mark
from scanapi.hide_utils import _hide, _override_info, hide_sensitive_info
def response(requests_mock):
requests_mock.get("http://test.com", text="data")
return requests.get("http://test.com")
class TestHideSensitiveInfo:
def mock__hide(self, mocker):
... | calls) | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_hide_utils.py | test_when_http_attr_does_not_have_the_field | assert | collection | 22 | import requests
from pytest import fixture, mark
from scanapi.hide_utils import _hide, _override_info, hide_sensitive_info
def response(requests_mock):
requests_mock.get("http://test.com", text="data")
return requests.get("http://test.com")
class TestOverrideInfo:
@mark.context("when http attr does not ... | {"abc": "123"} | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_hide_utils.py | test_overrides_headers | assert | string_literal | 21 | import requests
from pytest import fixture, mark
from scanapi.hide_utils import _hide, _override_info, hide_sensitive_info
def response(requests_mock):
requests_mock.get("http://test.com", text="data")
return requests.get("http://test.com")
class TestOverrideInfo:
@mark.it("should overrides headers")
... | "SENSITIVE_INFORMATION" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_hide_utils.py | test_overrides_url | assert | string_literal | 23 | import requests
from pytest import fixture, mark
from scanapi.hide_utils import _hide, _override_info, hide_sensitive_info
def response(requests_mock):
requests_mock.get("http://test.com", text="data")
return requests.get("http://test.com")
class TestOverrideInfo:
@mark.it("should overrides url")
def... | "http://test.com/users/SENSITIVE_INFORMATION/details" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_hide_utils.py | test_overrides_body | assert | string_literal | 23 | import requests
from pytest import fixture, mark
from scanapi.hide_utils import _hide, _override_info, hide_sensitive_info
def response(requests_mock):
requests_mock.get("http://test.com", text="data")
return requests.get("http://test.com")
class TestOverrideInfo:
@mark.it("should overrides body")
d... | b'{"id": "SENSITIVE_INFORMATION", "name": "Tarik", "yearsOfExperience": 2}' | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_hide_utils.py | test_overrides_params | assert | string_literal | 24 | import requests
from pytest import fixture, mark
from scanapi.hide_utils import _hide, _override_info, hide_sensitive_info
def response(requests_mock):
requests_mock.get("http://test.com", text="data")
return requests.get("http://test.com")
class TestOverrideInfo:
@mark.it("should overrides params")
... | "http://test.com/users/details?test=SENSITIVE_INFORMATION&test2=test&test=SENSITIVE_INFORMATION" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_main.py | test_call_save_preferences | assert | numeric_literal | 25 | import logging
import yaml
from click.testing import CliRunner
from pytest import mark
from scanapi.__main__ import run
log = logging.getLogger(__name__)
runner = CliRunner()
def yaml_error(*args, **kwargs):
raise yaml.YAMLError("error foo")
class TestRun:
@mark.context("when nothing wrong happens")
@m... | 4 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_main.py | test_should_log_error | assert | complex_expr | 32 | import logging
import yaml
from click.testing import CliRunner
from pytest import mark
from scanapi.__main__ import run
log = logging.getLogger(__name__)
runner = CliRunner()
def yaml_error(*args, **kwargs):
raise yaml.YAMLError("error foo")
class TestRun:
@mark.context("when something wrong happens")
... | caplog.text | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_reporter.py | test_init_output_path_and_template | assert | none_literal | 24 | import pathlib
from freezegun.api import FakeDatetime
from pytest import fixture, mark
from scanapi.reporter import Reporter
fake_results = [
{"response": "foo", "tests_results": [], "no_failure": True},
{"response": "bar", "tests_results": [], "no_failure": False},
]
class TestInit:
@mark.context("when... | None | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_reporter.py | test_should_write_to_default_output | assert_* | string_literal | 63 | import pathlib
from freezegun.api import FakeDatetime
from pytest import fixture, mark
from scanapi.reporter import Reporter
fake_results = [
{"response": "foo", "tests_results": [], "no_failure": True},
{"response": "bar", "tests_results": [], "no_failure": False},
]
class TestWrite:
def mocked__rende... | "w") | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_reporter.py | test_should_write_to_custom_output | assert_* | bool_literal | 62 | import pathlib
from freezegun.api import FakeDatetime
from pytest import fixture, mark
from scanapi.reporter import Reporter
fake_results = [
{"response": "foo", "tests_results": [], "no_failure": True},
{"response": "bar", "tests_results": [], "no_failure": False},
]
class TestWrite:
def mocked__rende... | True) | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_reporter.py | test_should_write_to_default_output | assert_* | bool_literal | 62 | import pathlib
from freezegun.api import FakeDatetime
from pytest import fixture, mark
from scanapi.reporter import Reporter
fake_results = [
{"response": "foo", "tests_results": [], "no_failure": True},
{"response": "bar", "tests_results": [], "no_failure": False},
]
class TestWrite:
def mocked__rende... | False) | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_reporter.py | test_init_output_path_and_template_3 | assert | string_literal | 23 | import pathlib
from freezegun.api import FakeDatetime
from pytest import fixture, mark
from scanapi.reporter import Reporter
fake_results = [
{"response": "foo", "tests_results": [], "no_failure": True},
{"response": "bar", "tests_results": [], "no_failure": False},
]
class TestInit:
@mark.context("whe... | "my-report.html" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_reporter.py | test_should_write_to_default_output | assert_* | string_literal | 66 | import pathlib
from freezegun.api import FakeDatetime
from pytest import fixture, mark
from scanapi.reporter import Reporter
fake_results = [
{"response": "foo", "tests_results": [], "no_failure": True},
{"response": "bar", "tests_results": [], "no_failure": False},
]
class TestWrite:
def mocked__rende... | "ScanAPI Report") | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_reporter.py | test_init_output_path_and_template_2 | assert | string_literal | 25 | import pathlib
from freezegun.api import FakeDatetime
from pytest import fixture, mark
from scanapi.reporter import Reporter
fake_results = [
{"response": "foo", "tests_results": [], "no_failure": True},
{"response": "bar", "tests_results": [], "no_failure": False},
]
class TestInit:
@mark.context("whe... | "my_template.jinja" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_reporter.py | test_init_output_path_and_template | assert | string_literal | 23 | import pathlib
from freezegun.api import FakeDatetime
from pytest import fixture, mark
from scanapi.reporter import Reporter
fake_results = [
{"response": "foo", "tests_results": [], "no_failure": True},
{"response": "bar", "tests_results": [], "no_failure": False},
]
class TestInit:
@mark.context("when... | "scanapi-report.html" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_scan.py | test_should_log_error | assert | numeric_literal | 53 | import errno
import logging
import os
import requests
import yaml
from pytest import fixture, mark, raises
from scanapi.errors import EmptyConfigFileError, InvalidKeyError
from scanapi.scan import open_report_in_browser, scan, write_report
log = logging.getLogger(__name__)
def file_not_found(*args, **kwargs):
r... | 4 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_scan.py | test_should_call_reporter | assert | numeric_literal | 50 | import errno
import logging
import os
import requests
import yaml
from pytest import fixture, mark, raises
from scanapi.errors import EmptyConfigFileError, InvalidKeyError
from scanapi.scan import open_report_in_browser, scan, write_report
log = logging.getLogger(__name__)
def file_not_found(*args, **kwargs):
r... | 0 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_scan.py | test_should_log_error | assert | variable | 52 | import errno
import logging
import os
import requests
import yaml
from pytest import fixture, mark, raises
from scanapi.errors import EmptyConfigFileError, InvalidKeyError
from scanapi.scan import open_report_in_browser, scan, write_report
log = logging.getLogger(__name__)
def file_not_found(*args, **kwargs):
r... | SystemExit | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_scan.py | test_should_log_error | assert | complex_expr | 55 | import errno
import logging
import os
import requests
import yaml
from pytest import fixture, mark, raises
from scanapi.errors import EmptyConfigFileError, InvalidKeyError
from scanapi.scan import open_report_in_browser, scan, write_report
log = logging.getLogger(__name__)
def file_not_found(*args, **kwargs):
r... | caplog.text | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_scan.py | test_should_call_reporter | assert_* | collection | 54 | import errno
import logging
import os
import requests
import yaml
from pytest import fixture, mark, raises
from scanapi.errors import EmptyConfigFileError, InvalidKeyError
from scanapi.scan import open_report_in_browser, scan, write_report
log = logging.getLogger(__name__)
def file_not_found(*args, **kwargs):
r... | [response]) | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_scan.py | test_should_call_reporter | assert_* | collection | 52 | import errno
import logging
import os
import requests
import yaml
from pytest import fixture, mark, raises
from scanapi.errors import EmptyConfigFileError, InvalidKeyError
from scanapi.scan import open_report_in_browser, scan, write_report
log = logging.getLogger(__name__)
def file_not_found(*args, **kwargs):
r... | {"endpoints": []}) | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_session.py | test_init_successes_and_failures | assert | numeric_literal | 12 | from random import randrange
from pytest import mark, raises
from scanapi.session import Session
class TestInit:
def test_init_successes_and_failures(self):
session = Session()
assert session.successes == | 0 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_session.py | test_increment | assert | variable | 17 | from random import randrange
from pytest import mark, raises
from scanapi.session import Session
class TestIncrementSuccesses:
@mark.it("should increment successes")
def test_increment(self):
session = Session()
times = randrange(1, 10)
for _ in range(times):
session.incr... | times | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_session.py | test_failed_when_there_is_failure | assert | variable | 20 | from random import randrange
from pytest import mark, raises
from scanapi.session import Session
class TestSucceed:
@mark.parametrize(
"failures, errors, expected",
[(0, 0, True), (1, 0, False), (0, 1, False), (2, 1, False)],
)
@mark.it(
"should fail when there is a failure and sh... | expected | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_session.py | test_return_time | assert | string_literal | 16 | from random import randrange
from pytest import mark, raises
from scanapi.session import Session
class TestElapsedTime:
@mark.it("should return time")
@mark.freeze_time("2020-06-15 18:54:57")
def test_return_time(self, freezer):
session = Session()
freezer.move_to("2020-06-15 18:56:38")
... | "0:01:41" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_session.py | test_exit_with_proper_error | assert | variable | 21 | from random import randrange
from pytest import mark, raises
from scanapi.session import Session
class TestExit:
@mark.it("should exit with proper error")
@mark.parametrize(
"failures, errors, error_code",
[(0, 0, 0), (1, 0, 1), (0, 1, 2), (1, 1, 2)],
)
def test_exit_with_proper_error... | SystemExit | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_session.py | test_exit_with_proper_error | assert | variable | 22 | from random import randrange
from pytest import mark, raises
from scanapi.session import Session
class TestExit:
@mark.it("should exit with proper error")
@mark.parametrize(
"failures, errors, error_code",
[(0, 0, 0), (1, 0, 1), (0, 1, 2), (1, 1, 2)],
)
def test_exit_with_proper_error... | error_code | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_session.py | test_init_started_at | assert | string_literal | 14 | from random import randrange
from pytest import mark, raises
from scanapi.session import Session
class TestStart:
@mark.it("should initialize started_at with current time")
@mark.freeze_time("2020-06-15 18:54:57")
def test_init_started_at(self):
session = Session()
assert str(session.st... | "2020-06-15 18:54:57" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_settings.py | test_should_init_with_default_values | assert | none_literal | 31 | from pytest import fixture, mark, raises
from scanapi.settings import settings
def mock_load_config_file(mocker):
return mocker.patch("scanapi.settings.load_config_file")
def mock_has_local_config_file(mocker):
return mocker.patch(
"scanapi.settings.Settings.has_local_config_file",
mocker.Pro... | None | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_settings.py | test_returns_true | assert | bool_literal | 33 | from pytest import fixture, mark, raises
from scanapi.settings import settings
def mock_load_config_file(mocker):
return mocker.patch("scanapi.settings.load_config_file")
def mock_has_local_config_file(mocker):
return mocker.patch(
"scanapi.settings.Settings.has_local_config_file",
mocker.Pro... | True | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_settings.py | test_returns_false | assert | bool_literal | 34 | from pytest import fixture, mark, raises
from scanapi.settings import settings
def mock_load_config_file(mocker):
return mocker.patch("scanapi.settings.load_config_file")
def mock_has_local_config_file(mocker):
return mocker.patch(
"scanapi.settings.Settings.has_local_config_file",
mocker.Pro... | False | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_settings.py | test_should_pass_config_path_as_none | assert_* | none_literal | 44 | from pytest import fixture, mark, raises
from scanapi.settings import settings
def mock_load_config_file(mocker):
return mocker.patch("scanapi.settings.load_config_file")
def mock_has_local_config_file(mocker):
return mocker.patch(
"scanapi.settings.Settings.has_local_config_file",
mocker.Pro... | None) | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_settings.py | test_should_pass_config_path | assert_* | string_literal | 44 | from pytest import fixture, mark, raises
from scanapi.settings import settings
def mock_load_config_file(mocker):
return mocker.patch("scanapi.settings.load_config_file")
def mock_has_local_config_file(mocker):
return mocker.patch(
"scanapi.settings.Settings.has_local_config_file",
mocker.Pro... | "foo.yaml") | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_settings.py | test_should_init_with_default_values | assert | string_literal | 30 | from pytest import fixture, mark, raises
from scanapi.settings import settings
def mock_load_config_file(mocker):
return mocker.patch("scanapi.settings.load_config_file")
def mock_has_local_config_file(mocker):
return mocker.patch(
"scanapi.settings.Settings.has_local_config_file",
mocker.Pro... | "scanapi.yaml" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_settings.py | test_should_save_preferences_2 | assert_* | string_literal | 43 | from pytest import fixture, mark, raises
from scanapi.settings import settings
def mock_load_config_file(mocker):
return mocker.patch("scanapi.settings.load_config_file")
def mock_has_local_config_file(mocker):
return mocker.patch(
"scanapi.settings.Settings.has_local_config_file",
mocker.Pro... | "./scanapi.conf") | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_settings.py | test_should_save_preferences | assert_* | string_literal | 42 | from pytest import fixture, mark, raises
from scanapi.settings import settings
def mock_load_config_file(mocker):
return mocker.patch("scanapi.settings.load_config_file")
def mock_has_local_config_file(mocker):
return mocker.patch(
"scanapi.settings.Settings.has_local_config_file",
mocker.Pro... | "my_config_file.yaml") | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_settings.py | test_should_raise_exception | assert | string_literal | 43 | from pytest import fixture, mark, raises
from scanapi.settings import settings
def mock_load_config_file(mocker):
return mocker.patch("scanapi.settings.load_config_file")
def mock_has_local_config_file(mocker):
return mocker.patch(
"scanapi.settings.Settings.has_local_config_file",
mocker.Pro... | "[Errno 2] No such file or directory: 'invalid/my_config_file.yaml'" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_settings.py | test_should_clean_and_save_preferences | assert | collection | 40 | from pytest import fixture, mark, raises
from scanapi.settings import settings
def mock_load_config_file(mocker):
return mocker.patch("scanapi.settings.load_config_file")
def mock_has_local_config_file(mocker):
return mocker.patch(
"scanapi.settings.Settings.has_local_config_file",
mocker.Pro... | { "spec_path": "path/spec-path", "output_path": "path/output-path", "template": None, "no_report": False, "open_browser": False, "config_path": "path/config-path", } | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_template_render.py | test_return_file_system_loader | assert | collection | 14 | import requests
from pytest import fixture, mark
from scanapi.template_render import _loader, render, render_body
class TestLoader:
@mark.context("when it is external")
@mark.it("should return file system loader")
def test_return_file_system_loader(self):
loader = _loader(True)
assert loa... | ["./"] | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_template_render.py | test_return_package_loader | assert | string_literal | 14 | import requests
from pytest import fixture, mark
from scanapi.template_render import _loader, render, render_body
class TestLoader:
@mark.context("when it is not external")
@mark.it("should return package loader")
def test_return_package_loader(self):
loader = _loader(False)
assert loader... | "templates" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_template_render.py | test_return_package_loader | assert | string_literal | 13 | import requests
from pytest import fixture, mark
from scanapi.template_render import _loader, render, render_body
class TestLoader:
@mark.context("when it is not external")
@mark.it("should return package loader")
def test_return_package_loader(self):
loader = _loader(False)
assert loade... | "PackageLoader" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_template_render.py | test_return_file_system_loader | assert | string_literal | 13 | import requests
from pytest import fixture, mark
from scanapi.template_render import _loader, render, render_body
class TestLoader:
@mark.context("when it is external")
@mark.it("should return file system loader")
def test_return_file_system_loader(self):
loader = _loader(True)
assert lo... | "FileSystemLoader" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_template_render.py | test_should_render_json | assert | func_call | 23 | import requests
from pytest import fixture, mark
from scanapi.template_render import _loader, render, render_body
class TestRender:
def mocked__get_template(self, mocker):
return mocker.patch("scanapi.template_render.Environment.get_template")
def mocked__request(self, mocker):
return mocker... | render_body(request) | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_template_render.py | test_should_call_jinja_render | assert_* | string_literal | 20 | import requests
from pytest import fixture, mark
from scanapi.template_render import _loader, render, render_body
class TestRender:
def mocked__get_template(self, mocker):
return mocker.patch("scanapi.template_render.Environment.get_template")
def mocked__request(self, mocker):
return mocker... | "my_template.jinja") | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_utils.py | test_should_not_mount_custom_adapters | assert | numeric_literal | 18 | import requests
from pytest import fixture, mark, raises
from scanapi.errors import InvalidKeyError, MissingMandatoryKeyError
from scanapi.utils import join_urls, session_with_retry, validate_keys
def response(requests_mock):
requests_mock.get("http://test.com", text="data")
return requests.get("http://test.c... | 0 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_utils.py | test_should_mount_custom_adapters | assert | numeric_literal | 19 | import requests
from pytest import fixture, mark, raises
from scanapi.errors import InvalidKeyError, MissingMandatoryKeyError
from scanapi.utils import join_urls, session_with_retry, validate_keys
def response(requests_mock):
requests_mock.get("http://test.com", text="data")
return requests.get("http://test.c... | 7 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_utils.py | test_build_url_properly | assert | variable | 60 | import requests
from pytest import fixture, mark, raises
from scanapi.errors import InvalidKeyError, MissingMandatoryKeyError
from scanapi.utils import join_urls, session_with_retry, validate_keys
def response(requests_mock):
requests_mock.get("http://test.com", text="data")
return requests.get("http://test.c... | expected | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_utils.py | test_should_raise_an_exception_2 | assert | string_literal | 25 | import requests
from pytest import fixture, mark, raises
from scanapi.errors import InvalidKeyError, MissingMandatoryKeyError
from scanapi.utils import join_urls, session_with_retry, validate_keys
def response(requests_mock):
requests_mock.get("http://test.com", text="data")
return requests.get("http://test.c... | "Missing 'key2' key(s) at 'endpoint' scope" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/test_utils.py | test_should_raise_an_exception | assert | string_literal | 24 | import requests
from pytest import fixture, mark, raises
from scanapi.errors import InvalidKeyError, MissingMandatoryKeyError
from scanapi.utils import join_urls, session_with_retry, validate_keys
def response(requests_mock):
requests_mock.get("http://test.com", text="data")
return requests.get("http://test.c... | "Invalid key 'key2' at 'endpoint' scope. Available keys are: ('key1', 'key3')" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_delay.py | test_when_node_has_no_delay | assert | numeric_literal | 11 | from pytest import mark
from scanapi.tree import EndpointNode
class TestDelay:
@mark.context("when node spec has no delay defined")
@mark.it("should set delay as 0")
def test_when_node_has_no_delay(self):
node = EndpointNode({"name": "node"})
assert node.delay == | 0 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_delay.py | test_when_node_has_delay | assert | numeric_literal | 12 | from pytest import mark
from scanapi.tree import EndpointNode
class TestDelay:
@mark.context("when node spec has a delay defined")
@mark.it("should set delay attribute accordingly")
def test_when_node_has_delay(self):
node = EndpointNode({"name": "node", "delay": 1})
assert node.delay ==... | 1 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_delay.py | test_when_parent_has_delay | assert | numeric_literal | 15 | from pytest import mark
from scanapi.tree import EndpointNode
class TestDelay:
@mark.context("when parent node spec has a delay defined")
@mark.it("should set delay attribute the same as the parent's one")
def test_when_parent_has_delay(self):
node = EndpointNode(
{"name": "node"},
... | 2 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_delay.py | test_when_both_node_and_parent_have_delay | assert | numeric_literal | 15 | from pytest import mark
from scanapi.tree import EndpointNode
class TestDelay:
@mark.context("when both node and parent specs have a delay defined")
@mark.it("should set delay attribute the same as the node's one")
def test_when_both_node_and_parent_have_delay(self):
node = EndpointNode(
... | 3 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_get_requests.py | test_when_node_has_children | assert | numeric_literal | 29 | from pytest import mark
from scanapi.tree import EndpointNode
class TestGetRequests:
@mark.context("when node has children")
@mark.it("should return the requests")
def test_when_node_has_children(self):
node = EndpointNode(
{
"endpoints": [
{
... | 2 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_get_specs.py | test_when_there_is_no_spec | assert | collection | 19 | from pytest import mark
from scanapi.tree import EndpointNode
class TestGetSpecs:
@mark.context("when both parent and child do not have the requested spec")
@mark.it("should return an empty dictionary")
def test_when_there_is_no_spec(self):
spec = {"name": "node", "requests": []}
parent ... | {} | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_get_specs.py | test_when_child_has_spec | assert | collection | 23 | from pytest import mark
from scanapi.tree import EndpointNode
class TestGetSpecs:
@mark.context("when child has the requested spec but parent does not")
@mark.it("should return child spec")
def test_when_child_has_spec(self):
spec = {
"headers": {"child_foo": "child_bar"},
... | {"child_foo": "child_bar"} | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_get_specs.py | test_when_parent_has_spec | assert | collection | 25 | from pytest import mark
from scanapi.tree import EndpointNode
class TestGetSpecs:
@mark.context("when parent has the requested spec but child does not")
@mark.it("should return parent spec")
def test_when_parent_has_spec(self):
spec = {"name": "node", "requests": []}
parent = EndpointNod... | {"parent_foo": "parent_bar"} | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_get_specs.py | test_when_parent_and_child_have_same_spec | assert | collection | 28 | from pytest import mark
from scanapi.tree import EndpointNode
class TestGetSpecs:
@mark.context("when both parent and child have the requested spec")
@mark.it("should return parent and child specs")
def test_when_parent_and_child_have_same_spec(self):
spec = {
"headers": {"child_foo": ... | {"parent_foo": "parent_bar", "child_foo": "child_bar"} | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_headers.py | test_when_parent_has_no_headers | assert | variable | 15 | from pytest import mark
from scanapi.tree import EndpointNode
class TestHeaders:
@mark.context("when parent spec has no headers attribute defined")
@mark.it("should set headers attribute the same as the node's one")
def test_when_parent_has_no_headers(self):
headers = {"abc": "def"}
node =... | headers | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_headers.py | test_when_parent_has_headers | assert | collection | 28 | from pytest import mark
from scanapi.tree import EndpointNode
class TestHeaders:
@mark.context(
"when both node and parent specs have a headers attribute defined"
)
@mark.it(
"should set headers attribute the result of merging "
"the node's and the parent's headers"
)
def ... | {"abc": "def", "xxx": "www"} | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_init.py | test_should_create_children | assert | func_call | 18 | from pytest import mark, raises
from scanapi.errors import MissingMandatoryKeyError
from scanapi.tree import EndpointNode
class TestInit:
@mark.context("when there are no mandatory keys missing")
@mark.it("should create children")
def test_should_create_children(self):
endpoints = [
{"... | len(endpoints) | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_init.py | test_missing_required_keys | assert | string_literal | 16 | from pytest import mark, raises
from scanapi.errors import MissingMandatoryKeyError
from scanapi.tree import EndpointNode
class TestInit:
@mark.context("when required keys are missing")
@mark.it("should raise missing mandatory key error")
def test_missing_required_keys(self):
with raises(MissingM... | "Missing 'name' key(s) at 'endpoint' scope" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_name.py | test_when_parent_has_no_name | assert | string_literal | 11 | from pytest import mark
from scanapi.tree import EndpointNode
class TestName:
@mark.context("when parent spec has no name defined")
@mark.it("should set child node's name")
def test_when_parent_has_no_name(self):
node = EndpointNode({"name": "child-node"}, parent=EndpointNode({}))
assert ... | "child-node" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_name.py | test_when_parent_has_name | assert | string_literal | 13 | from pytest import mark
from scanapi.tree import EndpointNode
class TestName:
@mark.context("when parent spec has a name defined")
@mark.it("should set parent_name::child_name")
def test_when_parent_has_name(self):
parent = EndpointNode({"name": "root"})
node = EndpointNode({"name": "chil... | "root::child-node" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_params.py | test_when_parent_has_no_params | assert | variable | 15 | from pytest import mark
from scanapi.tree import EndpointNode
class TestParams:
@mark.context("when parent spec has no params attribute defined")
@mark.it("should set params attribute the same as the node's one")
def test_when_parent_has_no_params(self):
params = {"abc": "def"}
node = Endp... | params | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_params.py | test_when_parent_has_params | assert | collection | 29 | from pytest import mark
from scanapi.tree import EndpointNode
class TestParams:
@mark.context("when parent has params")
@mark.context(
"when both node and parent specs have a params attribute defined"
)
@mark.it(
"should set params attribute the result of merging "
"the node's... | {"abc": "def", "xxx": "www"} | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_path.py | test_calls_evaluate | assert_* | variable | 27 | from pytest import fixture, mark
from scanapi.tree import EndpointNode
class TestPath:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.endpoint_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
@mark.it("should c... | calls) | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_path.py | test_when_parent_has_no_url | assert | variable | 24 | from pytest import fixture, mark
from scanapi.tree import EndpointNode
class TestPath:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.endpoint_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
@mark.context("whe... | base_path | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_path.py | test_with_path_not_string | assert | string_literal | 25 | from pytest import fixture, mark
from scanapi.tree import EndpointNode
class TestPath:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.endpoint_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
@mark.context("whe... | "http://foo.com/2" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_path.py | test_with_trailing_slashes | assert | string_literal | 30 | from pytest import fixture, mark
from scanapi.tree import EndpointNode
class TestPath:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.endpoint_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
@mark.context(
... | "http://foo.com/foo/" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_path.py | test_when_parent_has_url | assert | string_literal | 26 | from pytest import fixture, mark
from scanapi.tree import EndpointNode
class TestPath:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.endpoint_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
@mark.context("whe... | "http://foo.com/api/foo" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_repr.py | test_when_parent_has_no_name | assert | string_literal | 11 | from pytest import mark
from scanapi.tree import EndpointNode
class TestRepr:
@mark.context("when parent spec has no name defined")
@mark.it("should return <EndpointNode child-node>")
def test_when_parent_has_no_name(self):
node = EndpointNode({"name": "child-node"}, parent=EndpointNode({}))
... | "<EndpointNode child-node>" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_repr.py | test_when_parent_has_name | assert | string_literal | 13 | from pytest import mark
from scanapi.tree import EndpointNode
class TestRepr:
@mark.context("when parent spec has a name defined")
@mark.it("should return <EndpointNode root::child-node>")
def test_when_parent_has_name(self):
parent = EndpointNode({"name": "root"})
node = EndpointNode({"n... | "<EndpointNode root::child-node>" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_run.py | test_when_requests_are_successful | assert | numeric_literal | 51 | import logging
from pytest import fixture, mark
from scanapi.exit_code import ExitCode
from scanapi.tree import EndpointNode
log = logging.getLogger(__name__)
class TestRun:
def mock_run_request(self, mocker):
return mocker.patch("scanapi.tree.request_node.RequestNode.run")
def mock_session(self, ... | 2 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_run.py | test_when_request_fails | assert | numeric_literal | 51 | import logging
from pytest import fixture, mark
from scanapi.exit_code import ExitCode
from scanapi.tree import EndpointNode
log = logging.getLogger(__name__)
class TestRun:
def mock_run_request(self, mocker):
return mocker.patch("scanapi.tree.request_node.RequestNode.run")
def mock_session(self, ... | 1 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_run.py | test_when_request_fails | assert | complex_expr | 53 | import logging
from pytest import fixture, mark
from scanapi.exit_code import ExitCode
from scanapi.tree import EndpointNode
log = logging.getLogger(__name__)
class TestRun:
def mock_run_request(self, mocker):
return mocker.patch("scanapi.tree.request_node.RequestNode.run")
def mock_session(self, ... | caplog.text | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_run.py | test_when_requests_are_successful | assert | collection | 53 | import logging
from pytest import fixture, mark
from scanapi.exit_code import ExitCode
from scanapi.tree import EndpointNode
log = logging.getLogger(__name__)
class TestRun:
def mock_run_request(self, mocker):
return mocker.patch("scanapi.tree.request_node.RequestNode.run")
def mock_session(self, ... | ["foo", "bar"] | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_run.py | test_when_request_fails | assert | complex_expr | 60 | import logging
from pytest import fixture, mark
from scanapi.exit_code import ExitCode
from scanapi.tree import EndpointNode
log = logging.getLogger(__name__)
class TestRun:
def mock_run_request(self, mocker):
return mocker.patch("scanapi.tree.request_node.RequestNode.run")
def mock_session(self, ... | ExitCode.REQUEST_ERROR | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_validate.py | test_should_call_validate_keys | assert | numeric_literal | 38 | from pytest import fixture, mark
from scanapi.tree import EndpointNode, tree_keys
class TestValidate:
def mock_validate_keys(self, mocker):
return mocker.patch("scanapi.tree.endpoint_node.validate_keys")
@mark.it("should call the validate_keys method")
def test_should_call_validate_keys(self, mo... | 4 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_validate.py | test_should_call_validate_keys | assert | variable | 39 | from pytest import fixture, mark
from scanapi.tree import EndpointNode, tree_keys
class TestValidate:
def mock_validate_keys(self, mocker):
return mocker.patch("scanapi.tree.endpoint_node.validate_keys")
@mark.it("should call the validate_keys method")
def test_should_call_validate_keys(self, mo... | keys | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/endpoint_node/test_validate.py | test_should_call_validate_keys | assert_* | string_literal | 23 | from pytest import fixture, mark
from scanapi.tree import EndpointNode, tree_keys
class TestValidate:
def mock_validate_keys(self, mocker):
return mocker.patch("scanapi.tree.endpoint_node.validate_keys")
@mark.it("should call the validate_keys method")
def test_should_call_validate_keys(self, mo... | "endpoint") | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_body.py | test_when_request_has_no_body | assert | none_literal | 23 | from pytest import fixture, mark
from scanapi.tree import EndpointNode, RequestNode
class TestBody:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.request_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
@mark.... | None | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_body.py | test_calls_evaluate | assert_* | variable | 26 | from pytest import fixture, mark
from scanapi.tree import EndpointNode, RequestNode
class TestBody:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.request_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
@mark.... | calls) | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_body.py | test_when_request_has_body | assert | collection | 23 | from pytest import fixture, mark
from scanapi.tree import EndpointNode, RequestNode
class TestBody:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.request_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
@mark.... | {"abc": "def"} | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_delay.py | test_when_request_has_no_delay | assert | numeric_literal | 13 | from pytest import mark
from scanapi.tree import EndpointNode, RequestNode
class TestDelay:
@mark.context("when request spec has no delay defined")
@mark.it("should set delay as 0")
def test_when_request_has_no_delay(self):
request = RequestNode(
{"name": "foo"}, endpoint=EndpointNode(... | 0 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_delay.py | test_when_request_has_delay | assert | numeric_literal | 14 | from pytest import mark
from scanapi.tree import EndpointNode, RequestNode
class TestDelay:
@mark.context("when request spec has a delay defined")
@mark.it("should set delay attribute accordingly")
def test_when_request_has_delay(self):
request = RequestNode(
{"name": "foo", "delay": ... | 1 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_delay.py | test_when_endpoint_has_delay | assert | numeric_literal | 14 | from pytest import mark
from scanapi.tree import EndpointNode, RequestNode
class TestDelay:
@mark.context("when endpoint spec has a delay defined")
@mark.it("should set delay attribute the same as the endpoint's one")
def test_when_endpoint_has_delay(self):
request = RequestNode(
{"na... | 2 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_delay.py | test_when_both_request_and_endpoint_have_delay | assert | numeric_literal | 15 | from pytest import mark
from scanapi.tree import EndpointNode, RequestNode
class TestDelay:
@mark.context("when both request and endpoint specs have a delay defined")
@mark.it("should set delay attribute the same as the request's one")
def test_when_both_request_and_endpoint_have_delay(self):
req... | 3 | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_full_path_url.py | test_when_endpoint_has_no_url | assert | variable | 26 | from pytest import fixture, mark
from scanapi.tree import EndpointNode, RequestNode
class TestFullPathUrl:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.request_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
... | path | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_full_path_url.py | test_calls_evaluate | assert_* | variable | 27 | from pytest import fixture, mark
from scanapi.tree import EndpointNode, RequestNode
class TestFullPathUrl:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.request_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
... | calls) | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_full_path_url.py | test_with_path_not_string | assert | string_literal | 25 | from pytest import fixture, mark
from scanapi.tree import EndpointNode, RequestNode
class TestFullPathUrl:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.request_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
... | "http://foo.com/[]" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_full_path_url.py | test_with_trailing_slashes | assert | string_literal | 30 | from pytest import fixture, mark
from scanapi.tree import EndpointNode, RequestNode
class TestFullPathUrl:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.request_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
... | "http://foo.com/foo/" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_full_path_url.py | test_when_endpoint_has_url | assert | string_literal | 28 | from pytest import fixture, mark
from scanapi.tree import EndpointNode, RequestNode
class TestFullPathUrl:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.request_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
... | "http://foo.com/api/foo" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_headers.py | test_calls_evaluate | assert_* | variable | 34 | from pytest import fixture, mark
from scanapi.tree import EndpointNode, RequestNode
class TestHeaders:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.request_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
@ma... | calls) | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_headers.py | test_when_endpoint_has_no_headers | assert | variable | 24 | from pytest import fixture, mark
from scanapi.tree import EndpointNode, RequestNode
class TestHeaders:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.request_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
@ma... | headers | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_headers.py | test_when_endpoint_has_headers | assert | collection | 32 | from pytest import fixture, mark
from scanapi.tree import EndpointNode, RequestNode
class TestHeaders:
def mock_evaluate(self, mocker):
mock_func = mocker.patch(
"scanapi.tree.request_node.SpecEvaluator.evaluate"
)
mock_func.return_value = ""
return mock_func
@ma... | {"abc": "def", "xxx": "www"} | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
scanapi/scanapi | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | train | train | tests/unit/tree/request_node/test_http_method.py | test_when_request_has_method | assert | string_literal | 15 | from pytest import mark, raises
from scanapi.errors import HTTPMethodNotAllowedError
from scanapi.tree import EndpointNode, RequestNode
class TestHTTPMethod:
@mark.context("when request spec has an http method defined")
@mark.it("should set the http_method attribute accordingly")
def test_when_request_has... | "PUT" | e84c677595d0111d23c8da8db0b3d5c9d19ebdc1 | 71 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.