-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/MarvinTerry/HustLogin
- Loading branch information
Showing
8 changed files
with
193 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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,66 @@ | ||
name: Automated Testing of Interface Availability | ||
|
||
on: | ||
push: | ||
pull_request: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade setuptools | ||
pip install build | ||
- name: Build package | ||
run: python -m build | ||
|
||
- name: upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: dist/hust_login-*.whl | ||
|
||
- name: cleanup artifacts | ||
run: rm -r dist | ||
|
||
test: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [macos-latest, ubuntu-latest] #[windows-latest, macos-latest, ubuntu-latest] | ||
|
||
needs: build | ||
|
||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
|
||
- name: Set up python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
cd artifact | ||
pip install hust_login-*.whl | ||
python -m hust_login --autotest -U ${{ secrets.Uid }} -P ${{ secrets.Pwd }} | ||
#- name: release | ||
# uses: softprops/action-gh-release@v1 | ||
# with: | ||
# files: "dist/**" | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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,41 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-whl: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] #[windows-latest, macos-latest, ubuntu-latest] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade setuptools | ||
pip install build | ||
- name: Build package | ||
run: python -m build | ||
|
||
- name: upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: hust_login_${{ matrix.os }} | ||
path: dist/hust_login-*.whl | ||
|
||
- name: cleanup artifacts | ||
run: rm -r dist | ||
|
||
|
This file contains 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 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 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 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,37 @@ | ||
import sys | ||
import getopt | ||
|
||
def main(): | ||
try: | ||
opts, args = getopt.getopt(sys.argv[1:],'U:P:',['autotest']) | ||
except: | ||
print('USAGE: python -m hust_pass --autotest') | ||
|
||
bad_param = False | ||
autotest = False | ||
|
||
for opt,arg in opts: | ||
if opt in ['--autotest']: | ||
autotest = True | ||
elif opt =='-U': | ||
Uid = arg | ||
elif opt == '-P': | ||
Pwd = arg | ||
else: | ||
bad_param = True | ||
break | ||
|
||
if bad_param: | ||
print('USAGE: python -m hust_pass --autotest') | ||
return | ||
if autotest: | ||
from .autotest import full_test | ||
try: | ||
code = full_test(Uid,Pwd) | ||
except: | ||
print('Test Failed') | ||
return -1 | ||
return code | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains 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,22 @@ | ||
from . import HustPass | ||
|
||
def full_test(Uid,Pwd): | ||
hpass = HustPass(Uid, Pwd) | ||
try: | ||
hpass.QueryCurriculum('2023-04-27') | ||
hpass.QueryCurriculum(['2023-04-27','2023-03-27','2023-04-07']) | ||
hpass.QueryCurriculum(8) | ||
hpass.QueryCurriculum(('2023-04-01','2023-04-12')) | ||
except: | ||
return 10 | ||
try: | ||
hpass.QueryElectricityBills('2023-04-27') | ||
hpass.QueryElectricityBills(['2023-04-27','2023-03-27','2023-04-07']) | ||
hpass.QueryElectricityBills(('2023-04-01','2023-04-12')) | ||
except: | ||
return 20 | ||
try: | ||
hpass.QueryFreeRoom('2023-09-02') | ||
except: | ||
return 30 | ||
return 0 |
This file contains 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