fork download
  1. import pytest
  2. from elasticsearch import Elasticsearch
  3.  
  4.  
  5. @pytest.fixture()
  6. def es():
  7. es = Elasticsearch()
  8. return es
  9.  
  10.  
  11. def test_zsh_history_index_exists(es):
  12. assert es.indices.exists(index='zsh_history') is True
  13.  
  14.  
  15. def test_zsh_history_mapping_exists(es):
  16. zsh_history_mapping = es.indices.get_mapping(index='zsh_history')
  17. assert 'zsh_history' in zsh_history_mapping
  18.  
  19.  
  20. def test_zsh_history_mapping_has_correct_fields(es):
  21. timestamp_mapping = es.indices.get_field_mapping(index='zsh_history', fields='@timestamp')
  22. timestamp_type = timestamp_mapping['zsh_history']['mappings']['@timestamp']['mapping']['@timestamp']['type']
  23. assert timestamp_type == 'date'
  24.  
Runtime error #stdin #stdout #stderr 0.02s 27712KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 1, in <module>
ImportError: No module named 'pytest'