File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Generates new test files for models. Run from the root.
4+
5+ # allow generator to write test files
6+ sed -i.bak ' s/^test\/\*/# test\/*/' .openapi-generator-ignore && rm .openapi-generator-ignore.bak
7+ # remove current test files for models
8+ rm -f ./test/unit/models/test_* .py
9+ # generate new test files for models
10+ openapi-generator-cli generate -i bandwidth.yml -o ./ -c openapi-config.yml -g python > /dev/null
11+ # move generated model test files to the correct location (exclude api tests)
12+ for f in ./test/test_* .py; do
13+ [[ " $f " != * " _api.py" ]] && mv " $f " ./test/unit/models/
14+ done
15+ # remove remaining generated test files (api tests, etc.)
16+ rm -f ./test/test_* .py
17+ # discard changes to modified files only (leaves deletions and new test files intact)
18+ modified=$( git diff --name-only --diff-filter=M) && [ -n " $modified " ] && echo " $modified " | xargs git checkout --
You can’t perform that action at this time.
0 commit comments