-
Notifications
You must be signed in to change notification settings - Fork 10
fix: Test cases and refactor #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
priyanshshah2442
wants to merge
14
commits into
develop
Choose a base branch
from
test_cases_and_refactor
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
840a39b
fix: multiple fixes for automation
vorasmit 2e06fa5
fix: test case setup and refactor
priyanshshah2442 a901f02
fix: linters
priyanshshah2442 3d3b5c5
fix: test class setup and some test cases
priyanshshah2442 4607bee
fix: minor change
priyanshshah2442 c282728
fix: some more test cases
priyanshshah2442 d02464b
fix: minor refactor
priyanshshah2442 0558fcc
fix: changes as per review
priyanshshah2442 ac3b460
fix: server tests setup
priyanshshah2442 754d0cb
fix: minor change
priyanshshah2442 bfbc981
fix: failing tests
priyanshshah2442 0f9a89e
fix: some more test cases
priyanshshah2442 763ad2c
fix: add some more test cases
priyanshshah2442 8c9c4d4
fix: uncomment code
priyanshshah2442 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| # Check for merge conflicts before proceeding | ||
| python -m compileall -f "${GITHUB_WORKSPACE}" | ||
| if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}" | ||
| then echo "Found merge conflicts" | ||
| exit 1 | ||
| fi | ||
|
|
||
| cd ~ || exit | ||
|
|
||
| echo "Setting Up System Dependencies..." | ||
|
|
||
| sudo apt update | ||
|
|
||
| sudo apt remove mysql-server mysql-client | ||
| sudo apt install libcups2-dev redis-server mariadb-client | ||
|
|
||
| install_whktml() { | ||
| wget -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb | ||
| sudo apt install /tmp/wkhtmltox.deb | ||
| } | ||
| install_whktml & | ||
| wkpid=$! | ||
|
|
||
| pip install frappe-bench | ||
|
|
||
| git clone "https://github.com/frappe/frappe" --branch "$BRANCH_TO_CLONE" --depth 1 | ||
| bench init --skip-assets --frappe-path ~/frappe --python "$(which python)" frappe-bench | ||
|
|
||
| mkdir ~/frappe-bench/sites/test_site | ||
|
|
||
| cp -r "${GITHUB_WORKSPACE}/.github/helper/site_config.json" ~/frappe-bench/sites/test_site/ | ||
|
|
||
|
|
||
| mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e " | ||
| SET GLOBAL character_set_server = 'utf8mb4'; | ||
| SET GLOBAL collation_server = 'utf8mb4_unicode_ci'; | ||
|
|
||
| CREATE USER 'test_resilient'@'localhost' IDENTIFIED BY 'test_resilient'; | ||
| CREATE DATABASE test_resilient; | ||
| GRANT ALL PRIVILEGES ON \`test_resilient\`.* TO 'test_resilient'@'localhost'; | ||
|
|
||
| FLUSH PRIVILEGES; | ||
| " | ||
|
|
||
| cd ~/frappe-bench || exit | ||
|
|
||
| sed -i 's/watch:/# watch:/g' Procfile | ||
| sed -i 's/schedule:/# schedule:/g' Procfile | ||
| sed -i 's/socketio:/# socketio:/g' Procfile | ||
| sed -i 's/redis_socketio:/# redis_socketio:/g' Procfile | ||
|
|
||
| bench get-app erpnext --branch "$BRANCH_TO_CLONE" --resolve-deps | ||
| bench get-app payments_processor "${GITHUB_WORKSPACE}" | ||
| bench setup requirements --dev | ||
|
|
||
| wait $wkpid | ||
|
|
||
| bench use test_site | ||
| bench start & | ||
| bench reinstall --yes | ||
|
|
||
| bench --verbose install-app payments_processor | ||
| bench --site test_site add-to-hosts | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "db_host": "127.0.0.1", | ||
| "db_port": 3306, | ||
| "db_name": "test_frappe", | ||
| "db_password": "test_frappe", | ||
| "db_type": "mariadb", | ||
| "auto_email_id": "test@example.com", | ||
| "mail_server": "smtp.example.com", | ||
| "mail_login": "test@example.com", | ||
| "mail_password": "test", | ||
| "admin_password": "admin", | ||
| "root_login": "root", | ||
| "root_password": "travis", | ||
| "host_name": "http://test_site:8000", | ||
| "install_apps": ["erpnext"], | ||
| "throttle_user_limit": 100 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| name: Server Tests | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| base_ref: | ||
| type: string | ||
|
|
||
| app_name: | ||
| type: string | ||
|
|
||
|
|
||
| pull_request: | ||
| paths-ignore: | ||
| - "**.css" | ||
| - "**.js" | ||
| - "**.md" | ||
| - "**.html" | ||
| - "**.csv" | ||
|
|
||
| push: | ||
| branches: [version-15] | ||
| paths-ignore: | ||
| - "**.css" | ||
| - "**.js" | ||
| - "**.md" | ||
| - "**.html" | ||
| - "**.csv" | ||
| env: | ||
| BRANCH: ${{ inputs.base_ref || github.base_ref || github.ref_name }} | ||
| APP_NAME: ${{ inputs.app_name || 'payments_processor' }} | ||
|
|
||
| jobs: | ||
| tests: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 20 | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
|
|
||
| name: Python Unit Tests | ||
|
|
||
| services: | ||
| mariadb: | ||
| image: mariadb:10.6 | ||
| env: | ||
| MARIADB_ROOT_PASSWORD: "travis" | ||
| ports: | ||
| - 3306:3306 | ||
| options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3 | ||
|
|
||
| steps: | ||
| - name: Clone | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| check-latest: true | ||
|
|
||
| - name: Add to Hosts | ||
| run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts | ||
|
|
||
| - name: Cache pip | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.cache/pip | ||
| key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pip- | ||
| ${{ runner.os }}- | ||
|
|
||
| - name: Cache node modules | ||
| uses: actions/cache@v4 | ||
| env: | ||
| cache-name: cache-node-modules | ||
| with: | ||
| path: ~/.npm | ||
| key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-build-${{ env.cache-name }}- | ||
| ${{ runner.os }}-build- | ||
| ${{ runner.os }}- | ||
|
|
||
| - name: Get yarn cache directory path | ||
| id: yarn-cache-dir-path | ||
| run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | ||
|
|
||
| - uses: actions/cache@v4 | ||
| id: yarn-cache | ||
| with: | ||
| path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
| key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-yarn- | ||
|
|
||
| - name: Install | ||
| run: | | ||
| bash ${GITHUB_WORKSPACE}/.github/helper/install.sh | ||
| env: | ||
| BRANCH_TO_CLONE: ${{ env.BRANCH }} | ||
|
|
||
| - name: Run Tests | ||
| run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app ${{ env.APP_NAME }} --with-coverage | ||
| env: | ||
| TYPE: server | ||
|
|
||
| - name: Show bench output | ||
| if: ${{ always() }} | ||
| run: cat ~/frappe-bench/bench_start.log || true | ||
|
|
||
| - name: Upload coverage data | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage | ||
| path: /home/runner/frappe-bench/sites/coverage.xml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
payments_processor/payments_processor/constants/email_template.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.