From 73ec67ebea1bcfd6b7be13d66e486913c994c8c4 Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 30 Apr 2021 04:48:03 -0700 Subject: [PATCH] Add integration tests --- .editorconfig | 4 + .flake8 | 9 + .github/workflows/check-python.yml | 76 ++++ .github/workflows/spell-check.yml | 2 +- .github/workflows/test-integration.yml | 56 +++ Taskfile.yml | 22 ++ poetry.lock | 374 +++++++++++++++++- pyproject.toml | 14 +- test/__init__.py | 11 + test/pytest.ini | 9 + test/test_all.py | 324 +++++++++++++++ .../already-in-library-manager/diff.txt | 8 + .../repositories.txt | 2 + .../duplicates-in-submission/diff.txt | 9 + .../duplicates-in-submission/repositories.txt | 2 + test/testdata/list-deleted-diff/diff.txt | 8 + .../list-deleted-diff/repositories.txt | 2 + test/testdata/list-rename-diff/diff.txt | 11 + .../list-rename-diff/repositories.txt | 2 + test/testdata/modification/diff.txt | 8 + test/testdata/modification/repositories.txt | 2 + test/testdata/multi-file-diff/diff.txt | 15 + .../testdata/multi-file-diff/repositories.txt | 2 + test/testdata/no-library-properties/diff.txt | 8 + .../no-library-properties/repositories.txt | 2 + test/testdata/no-tags/diff.txt | 8 + test/testdata/no-tags/repositories.txt | 2 + test/testdata/non-list-diff/diff.txt | 7 + test/testdata/non-list-diff/repositories.txt | 2 + test/testdata/not-git-clone-url/diff.txt | 8 + .../not-git-clone-url/repositories.txt | 2 + test/testdata/not-supported-git-host/diff.txt | 8 + .../not-supported-git-host/repositories.txt | 2 + test/testdata/removal/diff.txt | 7 + test/testdata/removal/repositories.txt | 2 + test/testdata/type-arduino/diff.txt | 8 + test/testdata/type-arduino/repositories.txt | 2 + test/testdata/type-contributed/diff.txt | 8 + .../type-contributed/repositories.txt | 2 + test/testdata/type-partner/diff.txt | 8 + test/testdata/type-partner/repositories.txt | 2 + test/testdata/type-recommended/diff.txt | 8 + .../type-recommended/repositories.txt | 2 + test/testdata/url-404/diff.txt | 8 + test/testdata/url-404/repositories.txt | 2 + test/testdata/url-error/diff.txt | 8 + test/testdata/url-error/repositories.txt | 2 + 47 files changed, 1084 insertions(+), 6 deletions(-) create mode 100644 .flake8 create mode 100644 .github/workflows/check-python.yml create mode 100644 .github/workflows/test-integration.yml create mode 100644 test/__init__.py create mode 100644 test/pytest.ini create mode 100644 test/test_all.py create mode 100644 test/testdata/already-in-library-manager/diff.txt create mode 100644 test/testdata/already-in-library-manager/repositories.txt create mode 100644 test/testdata/duplicates-in-submission/diff.txt create mode 100644 test/testdata/duplicates-in-submission/repositories.txt create mode 100644 test/testdata/list-deleted-diff/diff.txt create mode 100644 test/testdata/list-deleted-diff/repositories.txt create mode 100644 test/testdata/list-rename-diff/diff.txt create mode 100644 test/testdata/list-rename-diff/repositories.txt create mode 100644 test/testdata/modification/diff.txt create mode 100644 test/testdata/modification/repositories.txt create mode 100644 test/testdata/multi-file-diff/diff.txt create mode 100644 test/testdata/multi-file-diff/repositories.txt create mode 100644 test/testdata/no-library-properties/diff.txt create mode 100644 test/testdata/no-library-properties/repositories.txt create mode 100644 test/testdata/no-tags/diff.txt create mode 100644 test/testdata/no-tags/repositories.txt create mode 100644 test/testdata/non-list-diff/diff.txt create mode 100644 test/testdata/non-list-diff/repositories.txt create mode 100644 test/testdata/not-git-clone-url/diff.txt create mode 100644 test/testdata/not-git-clone-url/repositories.txt create mode 100644 test/testdata/not-supported-git-host/diff.txt create mode 100644 test/testdata/not-supported-git-host/repositories.txt create mode 100644 test/testdata/removal/diff.txt create mode 100644 test/testdata/removal/repositories.txt create mode 100644 test/testdata/type-arduino/diff.txt create mode 100644 test/testdata/type-arduino/repositories.txt create mode 100644 test/testdata/type-contributed/diff.txt create mode 100644 test/testdata/type-contributed/repositories.txt create mode 100644 test/testdata/type-partner/diff.txt create mode 100644 test/testdata/type-partner/repositories.txt create mode 100644 test/testdata/type-recommended/diff.txt create mode 100644 test/testdata/type-recommended/repositories.txt create mode 100644 test/testdata/url-404/diff.txt create mode 100644 test/testdata/url-404/repositories.txt create mode 100644 test/testdata/url-error/diff.txt create mode 100644 test/testdata/url-error/repositories.txt diff --git a/.editorconfig b/.editorconfig index a5653b0..3b11984 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,6 +15,10 @@ indent_style = tab indent_size = unset indent_style = space +[*.py] +indent_size = 4 +indent_style = space + [*.{yaml,yml}] indent_size = 2 indent_style = space diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..aae0739 --- /dev/null +++ b/.flake8 @@ -0,0 +1,9 @@ +# See: https://flake8.pycqa.org/en/latest/user/configuration.html + +[flake8] +doctests = True +# W503 and W504 are mutually exclusive. PEP 8 recommends line break before. +ignore = W503 +max-complexity = 10 +max-line-length = 120 +select = E,W,F,C,N diff --git a/.github/workflows/check-python.yml b/.github/workflows/check-python.yml new file mode 100644 index 0000000..849b872 --- /dev/null +++ b/.github/workflows/check-python.yml @@ -0,0 +1,76 @@ +name: Check Python + +# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows +on: + push: + paths: + - ".github/workflows/check-python.yml" + - "**/.flake8" + - "**/poetry.lock" + - "**/pyproject.toml" + - "**/setup.cfg" + - "**/tox.ini" + - "**.py" + pull_request: + paths: + - ".github/workflows/check-python.yml" + - "**/.flake8" + - "**/poetry.lock" + - "**/pyproject.toml" + - "**/setup.cfg" + - "**/tox.ini" + - "**.py" + workflow_dispatch: + repository_dispatch: + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: "3.9" + + - name: Install Poetry + run: pip install poetry + + - name: Install Taskfile + uses: arduino/actions/setup-taskfile@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + version: 3.x + + - name: Run flake8 + run: task python:lint + + formatting: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: "3.9" + + - name: Install Poetry + run: pip install poetry + + - name: Install Taskfile + uses: arduino/actions/setup-taskfile@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + version: 3.x + + - name: Format Python code + run: task python:format + + - name: Check formatting + run: git diff --color --exit-code diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml index 8deea96..218a538 100644 --- a/.github/workflows/spell-check.yml +++ b/.github/workflows/spell-check.yml @@ -21,7 +21,7 @@ jobs: - name: Install Python uses: actions/setup-python@v2 with: - python-version: "3.8" + python-version: "3.9" - name: Install Poetry run: pip install poetry diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml new file mode 100644 index 0000000..698fe4b --- /dev/null +++ b/.github/workflows/test-integration.yml @@ -0,0 +1,56 @@ +name: Test Integration + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + paths: + - ".github/workflows/test-go.yml" + - "Taskfile.yml" + - "**.go" + - "go.mod" + - "go.sum" + - "poetry.lock" + - "pyproject.toml" + - "test/**" + pull_request: + paths: + - ".github/workflows/test-go.yml" + - "Taskfile.yml" + - "**.go" + - "go.mod" + - "go.sum" + - "poetry.lock" + - "pyproject.toml" + - "test/**" + workflow_dispatch: + repository_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: "1.14" + + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: "3.9" + + - name: Install Poetry + run: pip install poetry + + - name: Install Taskfile + uses: arduino/actions/setup-taskfile@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + version: 3.x + + - name: Run integration tests + run: task go:test-integration diff --git a/Taskfile.yml b/Taskfile.yml index 3707cdd..38ae281 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -14,12 +14,15 @@ tasks: - task: go:vet - task: go:lint - task: go:test + - task: go:test-integration + - task: python:lint - task: general:check-spelling format: desc: Format all files deps: - task: go:format + - task: python:format - task: general:format go:build: @@ -32,6 +35,13 @@ tasks: cmds: - go test -v -short -run '{{default ".*" .GO_TEST_REGEX}}' {{default "-timeout 10m -coverpkg=./... -covermode=atomic" .GO_TEST_FLAGS}} -coverprofile=coverage_unit.txt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} + go:test-integration: + desc: Run integration tests + cmds: + - task: go:build + - poetry install --no-root + - poetry run pytest test + go:vet: desc: Check for errors in Go code cmds: @@ -52,6 +62,18 @@ tasks: cmds: - go fmt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} + python:lint: + desc: Lint Python code + cmds: + - poetry install --no-root + - poetry run flake8 --show-source + + python:format: + desc: Automatically formats Python files + cmds: + - poetry install --no-root + - poetry run black . + general:format: desc: Format all supported files with Prettier cmds: diff --git a/poetry.lock b/poetry.lock index bb109db..ecafe20 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,5 +1,65 @@ [[package]] -category = "dev" +category = "main" +description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +name = "appdirs" +optional = false +python-versions = "*" +version = "1.4.4" + +[[package]] +category = "main" +description = "Atomic file writes." +marker = "sys_platform == \"win32\"" +name = "atomicwrites" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "1.4.0" + +[[package]] +category = "main" +description = "Classes Without Boilerplate" +name = "attrs" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "20.3.0" + +[package.extras] +dev = ["coverage (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "furo", "sphinx", "pre-commit"] +docs = ["furo", "sphinx", "zope.interface"] +tests = ["coverage (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"] +tests_no_zope = ["coverage (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six"] + +[[package]] +category = "main" +description = "The uncompromising code formatter." +name = "black" +optional = false +python-versions = ">=3.6.2" +version = "21.4b2" + +[package.dependencies] +appdirs = "*" +click = ">=7.1.2" +mypy-extensions = ">=0.4.3" +pathspec = ">=0.8.1,<1" +regex = ">=2020.1.8" +toml = ">=0.10.1" + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] +python2 = ["typed-ast (>=1.4.2)"] + +[[package]] +category = "main" +description = "Composable command line interface toolkit" +name = "click" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "7.1.2" + +[[package]] +category = "main" description = "Codespell" name = "codespell" optional = false @@ -10,13 +70,321 @@ version = "2.0.0" dev = ["check-manifest", "flake8", "pytest", "pytest-cov", "pytest-dependency"] hard-encoding-detection = ["chardet"] +[[package]] +category = "main" +description = "Cross-platform colored terminal text." +marker = "sys_platform == \"win32\"" +name = "colorama" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "0.4.4" + +[[package]] +category = "main" +description = "the modular source code checker: pep8 pyflakes and co" +name = "flake8" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" +version = "3.9.1" + +[package.dependencies] +mccabe = ">=0.6.0,<0.7.0" +pycodestyle = ">=2.7.0,<2.8.0" +pyflakes = ">=2.3.0,<2.4.0" + +[[package]] +category = "main" +description = "Polyfill package for Flake8 plugins" +name = "flake8-polyfill" +optional = false +python-versions = "*" +version = "1.0.2" + +[package.dependencies] +flake8 = "*" + +[[package]] +category = "main" +description = "iniconfig: brain-dead simple config-ini parsing" +name = "iniconfig" +optional = false +python-versions = "*" +version = "1.1.1" + +[[package]] +category = "main" +description = "Pythonic task execution" +name = "invoke" +optional = false +python-versions = "*" +version = "1.4.1" + +[[package]] +category = "main" +description = "McCabe checker, plugin for flake8" +name = "mccabe" +optional = false +python-versions = "*" +version = "0.6.1" + +[[package]] +category = "main" +description = "Experimental type system extensions for programs checked with the mypy typechecker." +name = "mypy-extensions" +optional = false +python-versions = "*" +version = "0.4.3" + +[[package]] +category = "main" +description = "Core utilities for Python packages" +name = "packaging" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "20.9" + +[package.dependencies] +pyparsing = ">=2.0.2" + +[[package]] +category = "main" +description = "Utility library for gitignore style pattern matching of file paths." +name = "pathspec" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "0.8.1" + +[[package]] +category = "main" +description = "Check PEP-8 naming conventions, plugin for flake8" +name = "pep8-naming" +optional = false +python-versions = "*" +version = "0.11.1" + +[package.dependencies] +flake8-polyfill = ">=1.0.2,<2" + +[[package]] +category = "main" +description = "plugin and hook calling mechanisms for python" +name = "pluggy" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "0.13.1" + +[package.extras] +dev = ["pre-commit", "tox"] + +[[package]] +category = "main" +description = "library with cross-python path, ini-parsing, io, code, log facilities" +name = "py" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "1.10.0" + +[[package]] +category = "main" +description = "Python style guide checker" +name = "pycodestyle" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "2.7.0" + +[[package]] +category = "main" +description = "passive checker of Python programs" +name = "pyflakes" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "2.3.1" + +[[package]] +category = "main" +description = "Python parsing module" +name = "pyparsing" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +version = "2.4.7" + +[[package]] +category = "main" +description = "pytest: simple powerful testing with Python" +name = "pytest" +optional = false +python-versions = ">=3.5" +version = "6.1.2" + +[package.dependencies] +atomicwrites = ">=1.0" +attrs = ">=17.4.0" +colorama = "*" +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<1.0" +py = ">=1.8.2" +toml = "*" + +[package.extras] +checkqa_mypy = ["mypy (0.780)"] +testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] + +[[package]] +category = "main" +description = "Alternative regular expression module, to replace re." +name = "regex" +optional = false +python-versions = "*" +version = "2021.4.4" + +[[package]] +category = "main" +description = "Python Library for Tom's Obvious, Minimal Language" +name = "toml" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +version = "0.10.2" + [metadata] -content-hash = "04bfba866bc7b58afdfc851fc8ec7e13967445b6124f0a03e78e8fdedd70c6e3" +content-hash = "7fbf71ab305b2ea6302c3d3f9d0a4c16a28f8acfec02593282daab63e33437c1" lock-version = "1.0" -python-versions = "^3.8" +python-versions = "^3.9" [metadata.files] +appdirs = [ + {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, + {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, +] +atomicwrites = [ + {file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"}, + {file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"}, +] +attrs = [ + {file = "attrs-20.3.0-py2.py3-none-any.whl", hash = "sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6"}, + {file = "attrs-20.3.0.tar.gz", hash = "sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"}, +] +black = [ + {file = "black-21.4b2-py3-none-any.whl", hash = "sha256:bff7067d8bc25eb21dcfdbc8c72f2baafd9ec6de4663241a52fb904b304d391f"}, + {file = "black-21.4b2.tar.gz", hash = "sha256:fc9bcf3b482b05c1f35f6a882c079dc01b9c7795827532f4cc43c0ec88067bbc"}, +] +click = [ + {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"}, + {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"}, +] codespell = [ {file = "codespell-2.0.0-py3-none-any.whl", hash = "sha256:a10b8bbb9f678e4edff7877af1f654fdc9e27c205f952c3ddee2981ad02ec5f2"}, {file = "codespell-2.0.0.tar.gz", hash = "sha256:dd9983e096b9f7ba89dd2d2466d1fc37231d060f19066331b9571341363c77b8"}, ] +colorama = [ + {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, + {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, +] +flake8 = [ + {file = "flake8-3.9.1-py2.py3-none-any.whl", hash = "sha256:3b9f848952dddccf635be78098ca75010f073bfe14d2c6bda867154bea728d2a"}, + {file = "flake8-3.9.1.tar.gz", hash = "sha256:1aa8990be1e689d96c745c5682b687ea49f2e05a443aff1f8251092b0014e378"}, +] +flake8-polyfill = [ + {file = "flake8-polyfill-1.0.2.tar.gz", hash = "sha256:e44b087597f6da52ec6393a709e7108b2905317d0c0b744cdca6208e670d8eda"}, + {file = "flake8_polyfill-1.0.2-py2.py3-none-any.whl", hash = "sha256:12be6a34ee3ab795b19ca73505e7b55826d5f6ad7230d31b18e106400169b9e9"}, +] +iniconfig = [ + {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, + {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, +] +invoke = [ + {file = "invoke-1.4.1-py2-none-any.whl", hash = "sha256:93e12876d88130c8e0d7fd6618dd5387d6b36da55ad541481dfa5e001656f134"}, + {file = "invoke-1.4.1-py3-none-any.whl", hash = "sha256:87b3ef9d72a1667e104f89b159eaf8a514dbf2f3576885b2bbdefe74c3fb2132"}, + {file = "invoke-1.4.1.tar.gz", hash = "sha256:de3f23bfe669e3db1085789fd859eb8ca8e0c5d9c20811e2407fa042e8a5e15d"}, +] +mccabe = [ + {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, + {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, +] +mypy-extensions = [ + {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, + {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, +] +packaging = [ + {file = "packaging-20.9-py2.py3-none-any.whl", hash = "sha256:67714da7f7bc052e064859c05c595155bd1ee9f69f76557e21f051443c20947a"}, + {file = "packaging-20.9.tar.gz", hash = "sha256:5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5"}, +] +pathspec = [ + {file = "pathspec-0.8.1-py2.py3-none-any.whl", hash = "sha256:aa0cb481c4041bf52ffa7b0d8fa6cd3e88a2ca4879c533c9153882ee2556790d"}, + {file = "pathspec-0.8.1.tar.gz", hash = "sha256:86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd"}, +] +pep8-naming = [ + {file = "pep8-naming-0.11.1.tar.gz", hash = "sha256:a1dd47dd243adfe8a83616e27cf03164960b507530f155db94e10b36a6cd6724"}, + {file = "pep8_naming-0.11.1-py2.py3-none-any.whl", hash = "sha256:f43bfe3eea7e0d73e8b5d07d6407ab47f2476ccaeff6937c84275cd30b016738"}, +] +pluggy = [ + {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, + {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, +] +py = [ + {file = "py-1.10.0-py2.py3-none-any.whl", hash = "sha256:3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a"}, + {file = "py-1.10.0.tar.gz", hash = "sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3"}, +] +pycodestyle = [ + {file = "pycodestyle-2.7.0-py2.py3-none-any.whl", hash = "sha256:514f76d918fcc0b55c6680472f0a37970994e07bbb80725808c17089be302068"}, + {file = "pycodestyle-2.7.0.tar.gz", hash = "sha256:c389c1d06bf7904078ca03399a4816f974a1d590090fecea0c63ec26ebaf1cef"}, +] +pyflakes = [ + {file = "pyflakes-2.3.1-py2.py3-none-any.whl", hash = "sha256:7893783d01b8a89811dd72d7dfd4d84ff098e5eed95cfa8905b22bbffe52efc3"}, + {file = "pyflakes-2.3.1.tar.gz", hash = "sha256:f5bc8ecabc05bb9d291eb5203d6810b49040f6ff446a756326104746cc00c1db"}, +] +pyparsing = [ + {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, + {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, +] +pytest = [ + {file = "pytest-6.1.2-py3-none-any.whl", hash = "sha256:4288fed0d9153d9646bfcdf0c0428197dba1ecb27a33bb6e031d002fa88653fe"}, + {file = "pytest-6.1.2.tar.gz", hash = "sha256:c0a7e94a8cdbc5422a51ccdad8e6f1024795939cc89159a0ae7f0b316ad3823e"}, +] +regex = [ + {file = "regex-2021.4.4-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:619d71c59a78b84d7f18891fe914446d07edd48dc8328c8e149cbe0929b4e000"}, + {file = "regex-2021.4.4-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:47bf5bf60cf04d72bf6055ae5927a0bd9016096bf3d742fa50d9bf9f45aa0711"}, + {file = "regex-2021.4.4-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:281d2fd05555079448537fe108d79eb031b403dac622621c78944c235f3fcf11"}, + {file = "regex-2021.4.4-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:bd28bc2e3a772acbb07787c6308e00d9626ff89e3bfcdebe87fa5afbfdedf968"}, + {file = "regex-2021.4.4-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:7c2a1af393fcc09e898beba5dd59196edaa3116191cc7257f9224beaed3e1aa0"}, + {file = "regex-2021.4.4-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:c38c71df845e2aabb7fb0b920d11a1b5ac8526005e533a8920aea97efb8ec6a4"}, + {file = "regex-2021.4.4-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:96fcd1888ab4d03adfc9303a7b3c0bd78c5412b2bfbe76db5b56d9eae004907a"}, + {file = "regex-2021.4.4-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:ade17eb5d643b7fead300a1641e9f45401c98eee23763e9ed66a43f92f20b4a7"}, + {file = "regex-2021.4.4-cp36-cp36m-win32.whl", hash = "sha256:e8e5b509d5c2ff12f8418006d5a90e9436766133b564db0abaec92fd27fcee29"}, + {file = "regex-2021.4.4-cp36-cp36m-win_amd64.whl", hash = "sha256:11d773d75fa650cd36f68d7ca936e3c7afaae41b863b8c387a22aaa78d3c5c79"}, + {file = "regex-2021.4.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:d3029c340cfbb3ac0a71798100ccc13b97dddf373a4ae56b6a72cf70dfd53bc8"}, + {file = "regex-2021.4.4-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:18c071c3eb09c30a264879f0d310d37fe5d3a3111662438889ae2eb6fc570c31"}, + {file = "regex-2021.4.4-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:4c557a7b470908b1712fe27fb1ef20772b78079808c87d20a90d051660b1d69a"}, + {file = "regex-2021.4.4-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:01afaf2ec48e196ba91b37451aa353cb7eda77efe518e481707e0515025f0cd5"}, + {file = "regex-2021.4.4-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:3a9cd17e6e5c7eb328517969e0cb0c3d31fd329298dd0c04af99ebf42e904f82"}, + {file = "regex-2021.4.4-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:90f11ff637fe8798933fb29f5ae1148c978cccb0452005bf4c69e13db951e765"}, + {file = "regex-2021.4.4-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:919859aa909429fb5aa9cf8807f6045592c85ef56fdd30a9a3747e513db2536e"}, + {file = "regex-2021.4.4-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:339456e7d8c06dd36a22e451d58ef72cef293112b559010db3d054d5560ef439"}, + {file = "regex-2021.4.4-cp37-cp37m-win32.whl", hash = "sha256:67bdb9702427ceddc6ef3dc382455e90f785af4c13d495f9626861763ee13f9d"}, + {file = "regex-2021.4.4-cp37-cp37m-win_amd64.whl", hash = "sha256:32e65442138b7b76dd8173ffa2cf67356b7bc1768851dded39a7a13bf9223da3"}, + {file = "regex-2021.4.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1e1c20e29358165242928c2de1482fb2cf4ea54a6a6dea2bd7a0e0d8ee321500"}, + {file = "regex-2021.4.4-cp38-cp38-manylinux1_i686.whl", hash = "sha256:314d66636c494ed9c148a42731b3834496cc9a2c4251b1661e40936814542b14"}, + {file = "regex-2021.4.4-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:6d1b01031dedf2503631d0903cb563743f397ccaf6607a5e3b19a3d76fc10480"}, + {file = "regex-2021.4.4-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:741a9647fcf2e45f3a1cf0e24f5e17febf3efe8d4ba1281dcc3aa0459ef424dc"}, + {file = "regex-2021.4.4-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:4c46e22a0933dd783467cf32b3516299fb98cfebd895817d685130cc50cd1093"}, + {file = "regex-2021.4.4-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:e512d8ef5ad7b898cdb2d8ee1cb09a8339e4f8be706d27eaa180c2f177248a10"}, + {file = "regex-2021.4.4-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:980d7be47c84979d9136328d882f67ec5e50008681d94ecc8afa8a65ed1f4a6f"}, + {file = "regex-2021.4.4-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:ce15b6d103daff8e9fee13cf7f0add05245a05d866e73926c358e871221eae87"}, + {file = "regex-2021.4.4-cp38-cp38-win32.whl", hash = "sha256:a91aa8619b23b79bcbeb37abe286f2f408d2f2d6f29a17237afda55bb54e7aac"}, + {file = "regex-2021.4.4-cp38-cp38-win_amd64.whl", hash = "sha256:c0502c0fadef0d23b128605d69b58edb2c681c25d44574fc673b0e52dce71ee2"}, + {file = "regex-2021.4.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:598585c9f0af8374c28edd609eb291b5726d7cbce16be6a8b95aa074d252ee17"}, + {file = "regex-2021.4.4-cp39-cp39-manylinux1_i686.whl", hash = "sha256:ee54ff27bf0afaf4c3b3a62bcd016c12c3fdb4ec4f413391a90bd38bc3624605"}, + {file = "regex-2021.4.4-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:7d9884d86dd4dd489e981d94a65cd30d6f07203d90e98f6f657f05170f6324c9"}, + {file = "regex-2021.4.4-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:bf5824bfac591ddb2c1f0a5f4ab72da28994548c708d2191e3b87dd207eb3ad7"}, + {file = "regex-2021.4.4-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:563085e55b0d4fb8f746f6a335893bda5c2cef43b2f0258fe1020ab1dd874df8"}, + {file = "regex-2021.4.4-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:b9c3db21af35e3b3c05764461b262d6f05bbca08a71a7849fd79d47ba7bc33ed"}, + {file = "regex-2021.4.4-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:3916d08be28a1149fb97f7728fca1f7c15d309a9f9682d89d79db75d5e52091c"}, + {file = "regex-2021.4.4-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:fd45ff9293d9274c5008a2054ecef86a9bfe819a67c7be1afb65e69b405b3042"}, + {file = "regex-2021.4.4-cp39-cp39-win32.whl", hash = "sha256:fa4537fb4a98fe8fde99626e4681cc644bdcf2a795038533f9f711513a862ae6"}, + {file = "regex-2021.4.4-cp39-cp39-win_amd64.whl", hash = "sha256:97f29f57d5b84e73fbaf99ab3e26134e6687348e95ef6b48cfd2c06807005a07"}, + {file = "regex-2021.4.4.tar.gz", hash = "sha256:52ba3d3f9b942c49d7e4bc105bb28551c44065f139a65062ab7912bef10c9afb"}, +] +toml = [ + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, +] diff --git a/pyproject.toml b/pyproject.toml index 23d3921..285edaa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,17 @@ description = "Arduino Library Manager submission parser" authors = ["Arduino "] [tool.poetry.dependencies] -python = "^3.8" +python = "^3.9" -[tool.poetry.dev-dependencies] +# Integration tests dependencies. +invoke = "1.4.1" +pytest = "6.1.2" + +black = { version = "^21.4b2", allow-prereleases = true } codespell = ">=2.0.0" +flake8 = "^3.9.1" +pep8-naming = "^0.11.1" + +[tool.black] +line-length = 120 +target-version = ["py39"] diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..36ea213 --- /dev/null +++ b/test/__init__.py @@ -0,0 +1,11 @@ +# Copyright 2020 ARDUINO SA (http://www.arduino.cc/) +# +# This software is released under the GNU General Public License version 3. +# The terms of this license can be found at: +# https://www.gnu.org/licenses/gpl-3.0.en.html +# +# You can be released from the requirements of the above licenses by purchasing +# a commercial license. Buying such a license is mandatory if you want to +# modify or otherwise use the software for commercial activities involving the +# Arduino software without disclosing the source code of your own applications. +# To purchase a commercial license, send an email to license@arduino.cc. diff --git a/test/pytest.ini b/test/pytest.ini new file mode 100644 index 0000000..d3f2009 --- /dev/null +++ b/test/pytest.ini @@ -0,0 +1,9 @@ +[pytest] +filterwarnings = + error + ignore::DeprecationWarning + ignore::ResourceWarning + +# --capture=no - disable per-test capture +# --tb=long sets the length of the traceback in case of failures +addopts = --capture=no --tb=long --verbose diff --git a/test/test_all.py b/test/test_all.py new file mode 100644 index 0000000..a14b2a5 --- /dev/null +++ b/test/test_all.py @@ -0,0 +1,324 @@ +# Copyright 2020 ARDUINO SA (http://www.arduino.cc/) +# +# This software is released under the GNU General Public License version 3. +# The terms of this license can be found at: +# https://www.gnu.org/licenses/gpl-3.0.en.html +# +# You can be released from the requirements of the above licenses by purchasing +# a commercial license. Buying such a license is mandatory if you want to +# modify or otherwise use the software for commercial activities involving the +# Arduino software without disclosing the source code of your own applications. +# To purchase a commercial license, send an email to license@arduino.cc. +import json +import pathlib +import platform +import typing + +import invoke.context +import pytest + +test_data_path = pathlib.Path(__file__).resolve().parent.joinpath("testdata") + + +@pytest.mark.parametrize( + "repopath_folder_name, expected_type, expected_submissions, expected_indexentry, expected_indexerlogsurls", + [ + ("list-deleted-diff", "other", None, "", ""), + ("multi-file-diff", "other", None, "", ""), + ("non-list-diff", "other", None, "", ""), + ("list-rename-diff", "other", None, "", ""), + ("removal", "removal", None, "", ""), + ( + "modification", + "modification", + [ + { + "submissionURL": "https://github.com/arduino-libraries/ArduinoCloudThing", + "normalizedURL": "https://github.com/arduino-libraries/ArduinoCloudThing.git", + "name": "ArduinoCloudThing", + "official": True, + "tag": "1.7.3", + "error": "", + } + ], + "https://github.com/arduino-libraries/ArduinoCloudThing.git|Arduino|ArduinoCloudThing", + "http://downloads.arduino.cc/libraries/logs/github.com/arduino-libraries/ArduinoCloudThing/", + ), + ( + "url-error", + "submission", + [ + { + "submissionURL": "foo", + "normalizedURL": "", + "name": "", + "official": False, + "tag": "", + "error": 'Unable to load submission URL: Get "foo": unsupported protocol scheme ""', + } + ], + "", + "http://downloads.arduino.cc/libraries/logs//", + ), + ( + "url-404", + "submission", + [ + { + "submissionURL": "http://httpstat.us/404", + "normalizedURL": "", + "name": "", + "official": False, + "tag": "", + "error": "Unable to load submission URL. Is the repository public?", + } + ], + "", + "http://downloads.arduino.cc/libraries/logs//", + ), + ( + "not-supported-git-host", + "submission", + [ + { + "submissionURL": "https://example.com", + "normalizedURL": "https://example.com/", + "name": "", + "official": False, + "tag": "", + "error": "example.com is not currently supported as a Git hosting website for Library Manager.%0A" + "See: https://github.com/arduino/library-registry/blob/main/FAQ.md#what-are-the-requirements-for-a-" + "library-to-be-added-to-library-manager", + } + ], + "", + "http://downloads.arduino.cc/libraries/logs/example.com//", + ), + ( + "not-git-clone-url", + "submission", + [ + { + "submissionURL": "https://github.com/arduino-libraries/ArduinoCloudThing/releases", + "normalizedURL": "https://github.com/arduino-libraries/ArduinoCloudThing/releases.git", + "name": "", + "official": False, + "tag": "", + "error": "Submission URL is not a Git clone URL (e.g., `https://github.com/arduino-libraries/Servo`" + ").", + } + ], + "", + "http://downloads.arduino.cc/libraries/logs/github.com/arduino-libraries/ArduinoCloudThing/releases/", + ), + ( + "already-in-library-manager", + "submission", + [ + { + "submissionURL": "https://github.com/arduino-libraries/Servo", + "normalizedURL": "https://github.com/arduino-libraries/Servo.git", + "name": "", + "official": False, + "tag": "", + "error": "Submission URL is already in the Library Manager index.", + } + ], + "", + "http://downloads.arduino.cc/libraries/logs/github.com/arduino-libraries/Servo/", + ), + ( + "type-arduino", + "submission", + [ + { + "submissionURL": "https://github.com/arduino-libraries/ArduinoCloudThing", + "normalizedURL": "https://github.com/arduino-libraries/ArduinoCloudThing.git", + "name": "ArduinoCloudThing", + "official": True, + "tag": "1.7.3", + "error": "", + } + ], + "https://github.com/arduino-libraries/ArduinoCloudThing.git|Arduino|ArduinoCloudThing", + "http://downloads.arduino.cc/libraries/logs/github.com/arduino-libraries/ArduinoCloudThing/", + ), + ( + "type-partner", + "submission", + [ + { + "submissionURL": "https://github.com/Azure/azure-iot-arduino-utility", + "normalizedURL": "https://github.com/Azure/azure-iot-arduino-utility.git", + "name": "AzureIoTUtility", + "official": False, + "tag": "v1.5.0", + "error": "", + } + ], + "https://github.com/Azure/azure-iot-arduino-utility.git|Partner|AzureIoTUtility", + "http://downloads.arduino.cc/libraries/logs/github.com/Azure/azure-iot-arduino-utility/", + ), + ( + "type-recommended", + "submission", + [ + { + "submissionURL": "https://github.com/adafruit/Adafruit_TinyFlash", + "normalizedURL": "https://github.com/adafruit/Adafruit_TinyFlash.git", + "name": "Adafruit TinyFlash", + "official": False, + "tag": "1.0.4", + "error": "", + } + ], + "https://github.com/adafruit/Adafruit_TinyFlash.git|Recommended|Adafruit TinyFlash", + "http://downloads.arduino.cc/libraries/logs/github.com/adafruit/Adafruit_TinyFlash/", + ), + ( + "type-contributed", + "submission", + [ + { + "submissionURL": "https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library", + "normalizedURL": "https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library.git", + "name": "SparkFun u-blox Arduino Library", + "official": False, + "tag": "v1.8.11", + "error": "", + } + ], + "https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library.git|Contributed|SparkFun u-blox Arduino Library" + "", + "http://downloads.arduino.cc/libraries/logs/github.com/sparkfun/SparkFun_Ublox_Arduino_Library/", + ), + ( + "no-tags", + "submission", + [ + { + "submissionURL": "https://github.com/arduino/cloud-examples", + "normalizedURL": "https://github.com/arduino/cloud-examples.git", + "name": "", + "official": True, + "tag": "", + "error": "The repository has no tags. You need to create a [release](https://docs.github.com/en/git" + "hub/administering-a-repository/managing-releases-in-a-repository) or [tag](https://git-scm.com/doc" + "s/git-tag) that matches the `version` value in the library's library.properties file.", + } + ], + "", + "http://downloads.arduino.cc/libraries/logs/github.com/arduino/cloud-examples/", + ), + ( + "no-library-properties", + "submission", + [ + { + "submissionURL": "https://github.com/arduino-libraries/WiFiLink-Firmware", + "normalizedURL": "https://github.com/arduino-libraries/WiFiLink-Firmware.git", + "name": "", + "official": True, + "tag": "1.0.1", + "error": "Library is missing a library.properties metadata file.", + } + ], + "", + "http://downloads.arduino.cc/libraries/logs/github.com/arduino-libraries/WiFiLink-Firmware/", + ), + ( + "duplicates-in-submission", + "submission", + [ + { + "submissionURL": "https://github.com/arduino-libraries/ArduinoCloudThing", + "normalizedURL": "https://github.com/arduino-libraries/ArduinoCloudThing.git", + "name": "ArduinoCloudThing", + "official": True, + "tag": "1.7.3", + "error": "", + }, + { + "submissionURL": "https://github.com/arduino-libraries/ArduinoCloudThing", + "normalizedURL": "https://github.com/arduino-libraries/ArduinoCloudThing.git", + "name": "ArduinoCloudThing", + "official": True, + "tag": "1.7.3", + "error": "Submission contains duplicate URLs.", + }, + ], + "https://github.com/arduino-libraries/ArduinoCloudThing.git|Arduino|ArduinoCloudThing%0A" + "https://github.com/arduino-libraries/ArduinoCloudThing.git|Arduino|ArduinoCloudThing", + "http://downloads.arduino.cc/libraries/logs/github.com/arduino-libraries/ArduinoCloudThing/%0A" + "http://downloads.arduino.cc/libraries/logs/github.com/arduino-libraries/ArduinoCloudThing/", + ), + ], +) +def test_request( + run_command, + repopath_folder_name, + expected_type, + expected_submissions, + expected_indexentry, + expected_indexerlogsurls, +): + diffpath = test_data_path.joinpath(repopath_folder_name, "diff.txt") + repopath = test_data_path.joinpath(repopath_folder_name) + listname = "repositories.txt" + + result = run_command(cmd=["--diffpath", diffpath, "--repopath", repopath, "--listname", listname]) + assert result.ok + + request = json.loads(result.stdout) + assert request["type"] == expected_type + assert request["submissions"] == expected_submissions + assert request["indexEntry"] == expected_indexentry + assert request["submissions"] == expected_submissions + assert request["indexerLogsURLs"] == expected_indexerlogsurls + + +@pytest.fixture(scope="function") +def run_command(pytestconfig, working_dir) -> typing.Callable[..., invoke.runners.Result]: + """Provide a wrapper around invoke's `run` API so that every test will work in the same temporary folder. + + Useful reference: + http://docs.pyinvoke.org/en/1.4/api/runners.html#invoke.runners.Result + """ + + executable_path = pathlib.Path(pytestconfig.rootdir).parent / "parser" + + def _run( + cmd: list, custom_working_dir: typing.Optional[str] = None, custom_env: typing.Optional[dict] = None + ) -> invoke.runners.Result: + if cmd is None: + cmd = [] + if not custom_working_dir: + custom_working_dir = working_dir + quoted_cmd = [] + for token in cmd: + quoted_cmd.append(f'"{token}"') + cli_full_line = '"{}" {}'.format(executable_path, " ".join(quoted_cmd)) + run_context = invoke.context.Context() + # It might happen that we need to change directories between drives on Windows, + # in that case the "/d" flag must be used otherwise directory wouldn't change + cd_command = "cd" + if platform.system() == "Windows": + cd_command += " /d" + # Context.cd() is not used since it doesn't work correctly on Windows. + # It escapes spaces in the path using "\ " but it doesn't always work, + # wrapping the path in quotation marks is the safest approach + with run_context.prefix(f'{cd_command} "{custom_working_dir}"'): + return run_context.run( + command=cli_full_line, echo=False, hide=True, warn=True, env=custom_env, encoding="utf-8" + ) + + return _run + + +@pytest.fixture(scope="function") +def working_dir(tmpdir_factory) -> str: + """Create a temporary folder for the test to run in. It will be created before running each test and deleted at the + end. This way all the tests work in isolation. + """ + work_dir = tmpdir_factory.mktemp(basename="TestWorkingDir") + yield str(work_dir) diff --git a/test/testdata/already-in-library-manager/diff.txt b/test/testdata/already-in-library-manager/diff.txt new file mode 100644 index 0000000..7c4a275 --- /dev/null +++ b/test/testdata/already-in-library-manager/diff.txt @@ -0,0 +1,8 @@ +diff --git a/repositories.txt b/repositories.txt +index c080a7a..1194257 100644 +--- a/repositories.txt ++++ b/repositories.txt +@@ -1,2 +1,3 @@ ++https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/already-in-library-manager/repositories.txt b/test/testdata/already-in-library-manager/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/already-in-library-manager/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/duplicates-in-submission/diff.txt b/test/testdata/duplicates-in-submission/diff.txt new file mode 100644 index 0000000..1bcd4e5 --- /dev/null +++ b/test/testdata/duplicates-in-submission/diff.txt @@ -0,0 +1,9 @@ +diff --git a/repositories.txt b/repositories.txt +index c080a7a..dcba162 100644 +--- a/repositories.txt ++++ b/repositories.txt +@@ -1,2 +1,3 @@ ++https://github.com/arduino-libraries/ArduinoCloudThing ++https://github.com/arduino-libraries/ArduinoCloudThing + https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/duplicates-in-submission/repositories.txt b/test/testdata/duplicates-in-submission/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/duplicates-in-submission/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/list-deleted-diff/diff.txt b/test/testdata/list-deleted-diff/diff.txt new file mode 100644 index 0000000..c304128 --- /dev/null +++ b/test/testdata/list-deleted-diff/diff.txt @@ -0,0 +1,8 @@ +diff --git a/repositories.txt b/repositories.txt +deleted file mode 100644 +index c080a7a..0000000 +--- a/repositories.txt ++++ /dev/null +@@ -1,2 +0,0 @@ +-https://github.com/arduino-libraries/Servo +-https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/list-deleted-diff/repositories.txt b/test/testdata/list-deleted-diff/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/list-deleted-diff/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/list-rename-diff/diff.txt b/test/testdata/list-rename-diff/diff.txt new file mode 100644 index 0000000..9d4e3e0 --- /dev/null +++ b/test/testdata/list-rename-diff/diff.txt @@ -0,0 +1,11 @@ +diff --git a/repositories.txt b/repositoriesfoo.txt +similarity index 61% +rename from repositories.txt +rename to repositoriesfoo.txt +index c080a7a..9a6503b 100644 +--- a/repositories.txt ++++ b/repositoriesfoo.txt +@@ -1,2 +1,3 @@ ++https://github.com/arduino-libraries/ArduinoCloudThing + https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/list-rename-diff/repositories.txt b/test/testdata/list-rename-diff/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/list-rename-diff/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/modification/diff.txt b/test/testdata/modification/diff.txt new file mode 100644 index 0000000..73e966d --- /dev/null +++ b/test/testdata/modification/diff.txt @@ -0,0 +1,8 @@ +diff --git a/repositories.txt b/repositories.txt +index c080a7a..75bd2f7 100644 +--- a/repositories.txt ++++ b/repositories.txt +@@ -1,2 +1,2 @@ +-https://github.com/arduino-libraries/Servo ++https://github.com/arduino-libraries/ArduinoCloudThing + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/modification/repositories.txt b/test/testdata/modification/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/modification/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/multi-file-diff/diff.txt b/test/testdata/multi-file-diff/diff.txt new file mode 100644 index 0000000..4a1a54d --- /dev/null +++ b/test/testdata/multi-file-diff/diff.txt @@ -0,0 +1,15 @@ +diff --git a/foo.txt b/foo.txt +index 257cc56..3bd1f0e 100644 +--- a/foo.txt ++++ b/foo.txt +@@ -1 +1,2 @@ + foo ++bar +diff --git a/repositories.txt b/repositories.txt +index c080a7a..9a6503b 100644 +--- a/repositories.txt ++++ b/repositories.txt +@@ -1,2 +1,3 @@ ++https://github.com/arduino-libraries/ArduinoCloudThing + https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/multi-file-diff/repositories.txt b/test/testdata/multi-file-diff/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/multi-file-diff/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/no-library-properties/diff.txt b/test/testdata/no-library-properties/diff.txt new file mode 100644 index 0000000..4af6467 --- /dev/null +++ b/test/testdata/no-library-properties/diff.txt @@ -0,0 +1,8 @@ +diff --git a/repositories.txt b/repositories.txt +index c080a7a..1194257 100644 +--- a/repositories.txt ++++ b/repositories.txt +@@ -1,2 +1,3 @@ ++https://github.com/arduino-libraries/WiFiLink-Firmware + https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/no-library-properties/repositories.txt b/test/testdata/no-library-properties/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/no-library-properties/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/no-tags/diff.txt b/test/testdata/no-tags/diff.txt new file mode 100644 index 0000000..73d23ec --- /dev/null +++ b/test/testdata/no-tags/diff.txt @@ -0,0 +1,8 @@ +diff --git a/repositories.txt b/repositories.txt +index c080a7a..1194257 100644 +--- a/repositories.txt ++++ b/repositories.txt +@@ -1,2 +1,3 @@ ++https://github.com/arduino/cloud-examples + https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/no-tags/repositories.txt b/test/testdata/no-tags/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/no-tags/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/non-list-diff/diff.txt b/test/testdata/non-list-diff/diff.txt new file mode 100644 index 0000000..5459915 --- /dev/null +++ b/test/testdata/non-list-diff/diff.txt @@ -0,0 +1,7 @@ +diff --git a/foo.txt b/foo.txt +index 257cc56..3bd1f0e 100644 +--- a/foo.txt ++++ b/foo.txt +@@ -1 +1,2 @@ + foo ++bar diff --git a/test/testdata/non-list-diff/repositories.txt b/test/testdata/non-list-diff/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/non-list-diff/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/not-git-clone-url/diff.txt b/test/testdata/not-git-clone-url/diff.txt new file mode 100644 index 0000000..e160403 --- /dev/null +++ b/test/testdata/not-git-clone-url/diff.txt @@ -0,0 +1,8 @@ +diff --git a/repositories.txt b/repositories.txt +index c080a7a..1194257 100644 +--- a/repositories.txt ++++ b/repositories.txt +@@ -1,2 +1,3 @@ ++https://github.com/arduino-libraries/ArduinoCloudThing/releases + https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/not-git-clone-url/repositories.txt b/test/testdata/not-git-clone-url/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/not-git-clone-url/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/not-supported-git-host/diff.txt b/test/testdata/not-supported-git-host/diff.txt new file mode 100644 index 0000000..f5fe72c --- /dev/null +++ b/test/testdata/not-supported-git-host/diff.txt @@ -0,0 +1,8 @@ +diff --git a/repositories.txt b/repositories.txt +index c080a7a..1194257 100644 +--- a/repositories.txt ++++ b/repositories.txt +@@ -1,2 +1,3 @@ ++https://example.com + https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/not-supported-git-host/repositories.txt b/test/testdata/not-supported-git-host/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/not-supported-git-host/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/removal/diff.txt b/test/testdata/removal/diff.txt new file mode 100644 index 0000000..f2f0ab1 --- /dev/null +++ b/test/testdata/removal/diff.txt @@ -0,0 +1,7 @@ +diff --git a/repositories.txt b/repositories.txt +index c080a7a..6041f28 100644 +--- a/repositories.txt ++++ b/repositories.txt +@@ -1,2 +1 @@ +-https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/removal/repositories.txt b/test/testdata/removal/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/removal/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/type-arduino/diff.txt b/test/testdata/type-arduino/diff.txt new file mode 100644 index 0000000..6160945 --- /dev/null +++ b/test/testdata/type-arduino/diff.txt @@ -0,0 +1,8 @@ +diff --git a/repositories.txt b/repositories.txt +index c080a7a..dcba162 100644 +--- a/repositories.txt ++++ b/repositories.txt +@@ -1,2 +1,3 @@ ++https://github.com/arduino-libraries/ArduinoCloudThing + https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/type-arduino/repositories.txt b/test/testdata/type-arduino/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/type-arduino/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/type-contributed/diff.txt b/test/testdata/type-contributed/diff.txt new file mode 100644 index 0000000..fd58d54 --- /dev/null +++ b/test/testdata/type-contributed/diff.txt @@ -0,0 +1,8 @@ +diff --git a/repositories.txt b/repositories.txt +index c080a7a..1194257 100644 +--- a/repositories.txt ++++ b/repositories.txt +@@ -1,2 +1,3 @@ ++https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library + https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/type-contributed/repositories.txt b/test/testdata/type-contributed/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/type-contributed/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/type-partner/diff.txt b/test/testdata/type-partner/diff.txt new file mode 100644 index 0000000..0de394d --- /dev/null +++ b/test/testdata/type-partner/diff.txt @@ -0,0 +1,8 @@ +diff --git a/repositories.txt b/repositories.txt +index c080a7a..dcba162 100644 +--- a/repositories.txt ++++ b/repositories.txt +@@ -1,2 +1,3 @@ ++https://github.com/Azure/azure-iot-arduino-utility + https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/type-partner/repositories.txt b/test/testdata/type-partner/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/type-partner/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/type-recommended/diff.txt b/test/testdata/type-recommended/diff.txt new file mode 100644 index 0000000..e128daa --- /dev/null +++ b/test/testdata/type-recommended/diff.txt @@ -0,0 +1,8 @@ +diff --git a/repositories.txt b/repositories.txt +index c080a7a..dcba162 100644 +--- a/repositories.txt ++++ b/repositories.txt +@@ -1,2 +1,3 @@ ++https://github.com/adafruit/Adafruit_TinyFlash + https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/type-recommended/repositories.txt b/test/testdata/type-recommended/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/type-recommended/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/url-404/diff.txt b/test/testdata/url-404/diff.txt new file mode 100644 index 0000000..0c1b527 --- /dev/null +++ b/test/testdata/url-404/diff.txt @@ -0,0 +1,8 @@ +diff --git a/repositories.txt b/repositories.txt +index c080a7a..1194257 100644 +--- a/repositories.txt ++++ b/repositories.txt +@@ -1,2 +1,3 @@ ++http://httpstat.us/404 + https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/url-404/repositories.txt b/test/testdata/url-404/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/url-404/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/url-error/diff.txt b/test/testdata/url-error/diff.txt new file mode 100644 index 0000000..3e733b9 --- /dev/null +++ b/test/testdata/url-error/diff.txt @@ -0,0 +1,8 @@ +diff --git a/repositories.txt b/repositories.txt +index c080a7a..dcba162 100644 +--- a/repositories.txt ++++ b/repositories.txt +@@ -1,2 +1,3 @@ ++foo + https://github.com/arduino-libraries/Servo + https://github.com/arduino-libraries/Stepper diff --git a/test/testdata/url-error/repositories.txt b/test/testdata/url-error/repositories.txt new file mode 100644 index 0000000..c080a7a --- /dev/null +++ b/test/testdata/url-error/repositories.txt @@ -0,0 +1,2 @@ +https://github.com/arduino-libraries/Servo +https://github.com/arduino-libraries/Stepper