Skip to content

Commit bd6c303

Browse files
authored
Add github action for publishing master branch coverage (dropbox#222)
* Add github action for publishing master branch coverage
1 parent 901a0a1 commit bd6c303

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

.github/workflows/codecovupload.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish CodeCov
2+
3+
on: push
4+
5+
jobs:
6+
deploy:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: [2.7, 3.x]
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Setup Python
15+
uses: actions/setup-python@v1
16+
with:
17+
python-version: ${{ matrix.python-version }}
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install -r requirements.txt
22+
pip install -r test/requirements.txt
23+
pip install coverage codecov
24+
- name: Run Coverage
25+
run: |
26+
coverage run --rcfile=.coveragerc -m pytest test/test_dropbox_unit.py
27+
coverage xml
28+
- name: Codecov
29+
uses: codecov/[email protected]
30+
with:
31+
file: ./coverage.xml
32+
flags: unittests
33+
env_vars: OS,PYTHON
34+
fail_ci_if_error: true

test/test_dropbox_unit.py

+16
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
EXPIRES_IN = 14400
1919
ACCOUNT_ID = 'dummy_account_id'
2020
USER_ID = 'dummy_user_id'
21+
ADMIN_ID = 'dummy_admin_id'
22+
TEAM_MEMBER_ID = 'dummy_team_member_id'
2123
SCOPE_LIST = ['files.metadata.read', 'files.metadata.write']
2224
EXPIRATION = datetime.utcnow() + timedelta(seconds=EXPIRES_IN)
2325

@@ -356,3 +358,17 @@ def test_team_client_refresh(self, session_instance):
356358
session=session_instance)
357359
dbx.check_and_refresh_access_token()
358360
session_instance.post.assert_called_once()
361+
362+
def test_team_client_as_admin(self, session_instance):
363+
dbx = DropboxTeam(oauth2_refresh_token=REFRESH_TOKEN,
364+
app_key=APP_KEY,
365+
app_secret=APP_SECRET,
366+
session=session_instance)
367+
dbx.as_admin(ADMIN_ID)
368+
369+
def test_team_client_as_user(self, session_instance):
370+
dbx = DropboxTeam(oauth2_refresh_token=REFRESH_TOKEN,
371+
app_key=APP_KEY,
372+
app_secret=APP_SECRET,
373+
session=session_instance)
374+
dbx.as_user(TEAM_MEMBER_ID)

0 commit comments

Comments
 (0)