Initial commit: Office365 web management platform
This commit is contained in:
31
tests/test_batch.py
Normal file
31
tests/test_batch.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from office365_admin.batch import parse_identifier_content, parse_table_content
|
||||
|
||||
|
||||
def test_parse_table_content_from_csv():
|
||||
content = "userPrincipalName,displayName,department\nalice, Alice Zhang,Sales\n"
|
||||
rows = parse_table_content(content)
|
||||
assert rows == [
|
||||
{
|
||||
"userPrincipalName": "alice",
|
||||
"displayName": "Alice Zhang",
|
||||
"department": "Sales",
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
def test_parse_table_content_from_json():
|
||||
rows = parse_table_content('[{"userPrincipalName":"bob@example.com","department":"IT"}]')
|
||||
assert rows[0]["userPrincipalName"] == "bob@example.com"
|
||||
assert rows[0]["department"] == "IT"
|
||||
|
||||
|
||||
def test_parse_identifier_content_from_lines():
|
||||
values = parse_identifier_content("alice\nbob@example.com\n")
|
||||
assert values == ["alice", "bob@example.com"]
|
||||
|
||||
|
||||
def test_parse_identifier_content_from_csv():
|
||||
content = "userPrincipalName,displayName\nalice@example.com,Alice\n"
|
||||
values = parse_identifier_content(content)
|
||||
assert values == ["alice@example.com"]
|
||||
|
||||
Reference in New Issue
Block a user