fixed new version of metrics for second_hdd test

This commit is contained in:
Cayo Puigdefabregas 2020-11-25 15:55:47 +01:00
parent 4421db3858
commit 821656ffc8
1 changed files with 4 additions and 16 deletions

View File

@ -1,6 +1,4 @@
import pytest import pytest
from datetime import timedelta
from datetime import datetime
from ereuse_devicehub.client import UserClient from ereuse_devicehub.client import UserClient
from ereuse_devicehub.resources.action import models as ma from ereuse_devicehub.resources.action import models as ma
@ -47,13 +45,8 @@ def test_simple_metrics(user: UserClient):
user.post(acer, res=ma.Snapshot) user.post(acer, res=ma.Snapshot)
# Check metrics # Check metrics
today = datetime.now()
delta = timedelta(days=30)
data = {"start_time": today-delta,
"end_time": today+delta
}
metrics = {'allocateds': 1, 'live': 1} metrics = {'allocateds': 1, 'live': 1}
res, _ = user.get("/metrics/", query_string=data) res, _ = user.get("/metrics/")
assert res == metrics assert res == metrics
@ -92,13 +85,8 @@ def test_second_hdd_metrics(user: UserClient):
hdd['serialNumber'] = 'WD-WX11A80W7440' hdd['serialNumber'] = 'WD-WX11A80W7440'
user.post(acer, res=ma.Snapshot) user.post(acer, res=ma.Snapshot)
# Check metrics # Check metrics if we change the hdd we need a result of one device
today = datetime.now() metrics = {'allocateds': 1, 'live': 1}
delta = timedelta(days=30) res, _ = user.get("/metrics/")
data = {"start_time": today-delta,
"end_time": today+delta
}
metrics = {'allocateds': 1, 'live': 2}
res, _ = user.get("/metrics/", query_string=data)
assert res == metrics assert res == metrics