|
| 1 | +import pytest |
| 2 | +from notecard import note |
| 3 | + |
| 4 | + |
| 5 | +@pytest.mark.parametrize( |
| 6 | + 'fluent_api,notecard_api,req_params,rename_map', |
| 7 | + [ |
| 8 | + ( |
| 9 | + note.add, |
| 10 | + 'note.add', |
| 11 | + { |
| 12 | + 'file': 'data.qo', |
| 13 | + 'body': {'key_a:', 'val_a', 'key_b', 42}, |
| 14 | + 'payload': 'ewogICJpbnRlcnZhbHMiOiI2MCwxMiwxNCIKfQ==', |
| 15 | + 'sync': True |
| 16 | + }, |
| 17 | + None |
| 18 | + ), |
| 19 | + ( |
| 20 | + note.changes, |
| 21 | + 'note.changes', |
| 22 | + { |
| 23 | + 'file': 'my-settings.db', |
| 24 | + 'tracker': 'inbound-tracker', |
| 25 | + 'maximum': 2, |
| 26 | + 'start': True, |
| 27 | + 'stop': True, |
| 28 | + 'delete': True, |
| 29 | + 'deleted': True |
| 30 | + }, |
| 31 | + { |
| 32 | + 'maximum': 'max' |
| 33 | + } |
| 34 | + ), |
| 35 | + ( |
| 36 | + note.delete, |
| 37 | + 'note.delete', |
| 38 | + { |
| 39 | + 'file': 'my-settings.db', |
| 40 | + 'note_id': 'my_note', |
| 41 | + }, |
| 42 | + { |
| 43 | + 'note_id': 'note' |
| 44 | + } |
| 45 | + ), |
| 46 | + ( |
| 47 | + note.get, |
| 48 | + 'note.get', |
| 49 | + { |
| 50 | + 'file': 'my-settings.db', |
| 51 | + 'note_id': 'my_note', |
| 52 | + 'delete': True, |
| 53 | + 'deleted': True |
| 54 | + }, |
| 55 | + { |
| 56 | + 'note_id': 'note' |
| 57 | + } |
| 58 | + ), |
| 59 | + ( |
| 60 | + note.template, |
| 61 | + 'note.template', |
| 62 | + { |
| 63 | + 'file': 'my-settings.db', |
| 64 | + 'body': {'key_a:', 'val_a', 'key_b', 42}, |
| 65 | + 'length': 42 |
| 66 | + }, |
| 67 | + None |
| 68 | + ), |
| 69 | + ( |
| 70 | + note.update, |
| 71 | + 'note.update', |
| 72 | + { |
| 73 | + 'file': 'my-settings.db', |
| 74 | + 'note_id': 'my_note', |
| 75 | + 'body': {'key_a:', 'val_a', 'key_b', 42}, |
| 76 | + 'payload': 'ewogICJpbnRlcnZhbHMiOiI2MCwxMiwxNCIKfQ==' |
| 77 | + }, |
| 78 | + { |
| 79 | + 'note_id': 'note' |
| 80 | + } |
| 81 | + ) |
| 82 | + ] |
| 83 | +) |
| 84 | +class TestNote: |
| 85 | + def test_fluent_api_maps_notecard_api_correctly( |
| 86 | + self, fluent_api, notecard_api, req_params, rename_map, |
| 87 | + run_fluent_api_notecard_api_mapping_test): |
| 88 | + run_fluent_api_notecard_api_mapping_test(fluent_api, notecard_api, |
| 89 | + req_params, rename_map) |
| 90 | + |
| 91 | + def test_fluent_api_fails_with_invalid_notecard( |
| 92 | + self, fluent_api, notecard_api, req_params, rename_map, |
| 93 | + run_fluent_api_invalid_notecard_test): |
| 94 | + run_fluent_api_invalid_notecard_test(fluent_api, req_params) |
0 commit comments