Feat: test on pandas xlsx and ods file reader
This commit is contained in:
BIN
tests/repository/fs_examples/username-password-recovery-code.xls
Normal file
BIN
tests/repository/fs_examples/username-password-recovery-code.xls
Normal file
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
Username; Identifier;First name;Last name
|
||||
Username;Identifier;First name;Last name
|
||||
booker12;9012;Rachel;Booker
|
||||
grey07;2070;Laura;Grey
|
||||
johnson81;4081;Craig;Johnson
|
||||
|
||||
|
@@ -2,6 +2,7 @@ import shutil
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from pandas import pandas
|
||||
|
||||
from dashboard.libs.repository.fs_repository import FSRepository
|
||||
|
||||
@@ -42,5 +43,42 @@ def test_init(location):
|
||||
assert repo.tables("username") == [
|
||||
"username.csv",
|
||||
"username-password-recovery-code.xlsx",
|
||||
"username-password-recovery-code.xls",
|
||||
]
|
||||
assert repo.tables("salary") == ["salary.pdf"]
|
||||
|
||||
|
||||
def test_read_csv(location):
|
||||
repo = FSRepository("example", location)
|
||||
username = repo.read("username.csv", "username", delimiter=";")
|
||||
assert list(username.columns) == [
|
||||
"Username",
|
||||
"Identifier",
|
||||
"First name",
|
||||
"Last name",
|
||||
]
|
||||
assert len(username.index) == 5
|
||||
|
||||
|
||||
def test_fake_read_xlsx(location):
|
||||
repo = FSRepository("example", location)
|
||||
df = pandas.read_excel(
|
||||
location / "username" / "username-password-recovery-code.xls"
|
||||
)
|
||||
print(df)
|
||||
|
||||
|
||||
def test_read_xlsx(location):
|
||||
repo = FSRepository("example", location)
|
||||
username = repo.read("username-password-recovery-code.xls", "username")
|
||||
assert list(username.columns) == [
|
||||
"Username",
|
||||
"Identifier",
|
||||
"One-time password",
|
||||
"Recovery code",
|
||||
"First name",
|
||||
"Last name",
|
||||
"Department",
|
||||
"Location",
|
||||
]
|
||||
assert len(username.index) == 5
|
||||
|
||||
Reference in New Issue
Block a user