Skip to content

Commit b97bbda

Browse files
author
saul-data
committed
update sharepoint api and tests
1 parent 474f639 commit b97bbda

File tree

6 files changed

+39
-7
lines changed

6 files changed

+39
-7
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Dataplane Python Package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.7", "3.8", "3.9", "3.10"]
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
if [ -f .devcontainer/requirements.txt ]; then pip install -r .devcontainer/requirements.txt; fi
26+
- name: Test with pytest
27+
run: |
28+
pytest -s

notes-distribute.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ rm -rf ./dist && python3 -m build
99
```
1010

1111
3. Remove previous version and distribute new package
12+
To use the .pypirc file for authentication, come out of devcontainers
1213
```shell
1314
python3 -m pip install --upgrade twine
1415
python3 -m twine upload dist/*

src/dataplane/Microsoft/Sharepoint/sharepoint_upload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def sharepoint_upload(Host, TenantID, ClientID, Secret, SiteName, TargetFilePath
6060

6161
# ======= Get Site ID from Site name ====
6262
SiteName = SiteName.replace(" ", "")
63-
SiteID = requests.request("GET", f"https://graph.microsoft.com/v1.0/sites/{Host}:/sites/{SiteName}", headers=headers, json=payload, proxies=proxies)
63+
SiteID = requests.request("GET", f"https://graph.microsoft.com/v1.0/sites/{Host}:/sites/{SiteName}?$select=id", headers=headers, json=payload, proxies=proxies)
6464

6565
if SiteID.status_code != 200:
6666
duration = datetime.now() - start

src/dataplane/Microsoft/Sharepoint/test_sharepoint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_sharepoint():
3939
SourceFilePath=CURRENT_DIRECTORY+"/test_cities.csv",
4040
UploadMethod="File"
4141
)
42-
print(rs)
42+
# print(rs)
4343
assert rs["result"]=="OK"
4444

4545

@@ -54,7 +54,7 @@ def test_sharepoint():
5454
LocalFilePath=CURRENT_DIRECTORY+"/test_cities_delete.csv",
5555
DownloadMethod="File",
5656
ProxyUse=False, ProxyUrl="", ProxyMethod="https")
57-
print(rs)
57+
# print(rs)
5858
assert rs["result"]=="OK"
5959
# Get the data
6060
# rsget = S3Get(StoreKey="s3me", S3Client=S3Connect, Bucket=bucket)

src/dataplane/Microsoft/Sharepoint/test_sharepoint_nonroot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_sharepoint_nonroot():
4040
Library="Doc library 2",
4141
UploadMethod="File"
4242
)
43-
print(rs)
43+
# print(rs)
4444
assert rs["result"]=="OK"
4545

4646

@@ -56,7 +56,7 @@ def test_sharepoint_nonroot():
5656
Library="Doc library 2",
5757
DownloadMethod="File",
5858
ProxyUse=False, ProxyUrl="", ProxyMethod="https")
59-
print(rs)
59+
# print(rs)
6060
assert rs["result"]=="OK"
6161
# Get the data
6262
# rsget = S3Get(StoreKey="s3me", S3Client=S3Connect, Bucket=bucket)

src/dataplane/Microsoft/Sharepoint/test_sharepoint_object.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from .sharepoint_upload import sharepoint_upload
66
from .sharepoint_download import sharepoint_download
77
from nanoid import generate
8+
from io import BytesIO
89

910
def test_sharepoint_object():
1011

@@ -43,7 +44,7 @@ def test_sharepoint_object():
4344
UploadObject=UploadObject,
4445
UploadMethod="Object"
4546
)
46-
print(rs)
47+
# print(rs)
4748
assert rs["result"]=="OK"
4849

4950

@@ -65,8 +66,10 @@ def test_sharepoint_object():
6566
# Get the data
6667
# rsget = S3Get(StoreKey="s3me", S3Client=S3Connect, Bucket=bucket)
6768
# print(rsget)
68-
df = read_csv(rs["content"])
69+
df = read_csv(BytesIO(rs["content"]))
70+
print(df.head(3))
6971
# print(df.shape[0])
72+
assert df.shape[0]==13
7073
# # Test before and after rows
7174
# assert df.shape[0] == dfrows
7275
# assert rsget["result"]=="OK"

0 commit comments

Comments
 (0)