Beispiel #1
0
 def test_get(self):
     from core.Status import Status
     test_id = str(uuid.uuid4())
     test_status = 'FAILURE'
     details = {'browser': random.choice(['Firefox', 'Chrome'])}
     test_type = str(uuid.uuid4())
     status = Status(test_id, test_type, test_status, details=details)
     status.save()
     status_jid = Status(base_id=status._id)
     status_get = status_jid.get()
     assert status_get.to_dict() == status.to_dict()
Beispiel #2
0
 def test_expand_failed(self):
     from core import Base
     from core.Status import Status
     test_id = str(uuid.uuid4())
     test_status = 'SUCCESS'
     test_type = str(uuid.uuid4())
     status = Status(test_id, test_type, test_status)
     status_id = str(Base.Base().insert(Status.collection, status.to_dict()))
     rv = self.app.get('/api/v1/statuses/{0}'.format(status_id))
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert type(res['status']['test']) in [type('String'), type(u'Unicode')]
     rv = self.app.get('/api/v1/statuses/{0}?expand=test'.format(status_id))
     assert rv.status_code == 200
     res = json.loads(rv.data.decode('utf-8'))
     assert type(res['status']['test']) in [type('String'), type(u'Unicode')]
Beispiel #3
0
 def test_repr_getter_setter(self):
     from core.Status import Status
     test_id = str(uuid.uuid4())
     test_status = random.choice(['SUCCESS', 'FAILURE'])
     test_type = str(uuid.uuid4())
     status = Status(test_id, test_type, test_status)
     assert '{0}'.format(status) == '<Status {0} ({1}) : {2} on the {3}>'.format(test_id, test_type, test_status, None)
     assert status.to_dict() == {'test_id': test_id, 'status': test_status, 'type': test_type}
     status._on = datetime.datetime.now()
     status._last = True
     status._details = {'browser': random.choice(['Firefox', 'Chrome'])}
     assert status.to_dict()['on'] == status._on.replace(microsecond=0)
     assert status.to_dict()['last'] == status._last
     assert status.to_dict()['details'] == status._details
     status2 = status.from_dict(status.to_dict())
     assert status2.to_dict() == status.to_dict()