def test_nested_payload_not_allowed(basic_event): basic_event['payload'] = { 'turtle': { 'turtle': { 'turtle': { 'turtle': 'turtle' } } } } with pytest.raises(CosmologgerException): CosmologEvent.from_dict(basic_event)
def test_invalid_origin(basic_event): basic_event['origin'] = 'spaces are not allowed' with pytest.raises(CosmologgerException): CosmologEvent.from_dict(basic_event)
def test_invalid_stream_name(basic_event): basic_event['stream_name'] = '%&^' with pytest.raises(CosmologgerException): CosmologEvent.from_dict(basic_event)
def test_from_dict(basic_event): e = CosmologEvent.from_dict(basic_event) assert e == basic_event