This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
devicehub-teal/tests/test_reports.py

22 lines
647 B
Python
Raw Normal View History

2018-10-18 15:36:14 +00:00
import csv
import pytest
2018-10-11 16:19:33 +00:00
from ereuse_devicehub.client import UserClient
from ereuse_devicehub.resources.device.models import Device
from ereuse_devicehub.resources.event.models import Snapshot
from tests.conftest import file
2018-10-18 15:36:14 +00:00
def test_export_endpoint(user: UserClient):
2018-10-11 16:19:33 +00:00
snapshot, _ = user.post(file('basic.snapshot'), res=Snapshot)
2018-10-18 15:36:14 +00:00
device_type = snapshot['device']['type']
csv_list, _ = user.get(res=Device, accept='text/csv')
read_csv = csv.reader(csv_list, delimiter=',')
dates = []
for row in read_csv:
date = row[0]
dates.append(date)
2018-10-11 16:19:33 +00:00
2018-10-18 15:36:14 +00:00
assert dates[1] == device_type, 'Device type are not equal'