def test_create_test_builds_correctly():
    t = Tackle('some_filename.txt')
    assert len(t._tests) == 0
    assert len(t._results.keys()) == 0
    t.create_test(
        test_name='test the test',
        input_routing_key='test key 1',
        output_routing_key='test key 2',
        dataset=None, # not actually running the test so not a problem
    )
    assert len(t._tests) == 1
    assert len(t._results.keys()) == 1
    assert t._results.get('test the test') != None
Example #2
0
import asyncio
import json
import logging

from tackle import Tackle

logging.basicConfig(level="DEBUG")
log = logging.getLogger(__name__)

t = Tackle(output_path='any.txt')

input = json.loads(
    '{"type": "PUBLISH_NEW_CITATION", "user": "******", "timestamp": "definitely right now", "payload": {"text": "oh hi there, some very interesting! sample! text!", "GUID": "fake-citation-3599", "tags": [], "meta": {}}}'
)
output = json.loads(
    '{"type": "CITATION_PUBLISHED", "user": "******", "timestamp": "definitely right now", "priority": 1, "payload": {"text": "oh hi there, some very interesting! sample! text!", "GUID": "fake-citation-3599", "tags": [], "meta": {}}}'
)
data = [{'in': input, 'out': output}]

t.create_test(test_name='Test setup',
              input_routing_key='command.writemodel',
              output_routing_key='event.emitted',
              dataset=data)

t.run_tests()
results = t.results()