- create database trigger function
- generate public private key Ed25519255 into database
- test database trigger function
- generate public key and private key mock data in event table
optional for this scope
- passphrase encryption in database
https://app.scrumdesk.com/#/projects/33918/work-scrum/803620-task
example event row after insert function trigger
<Record slug='stamp-show' layout_venue_slug=None layout_slug=None name='Stamp Show' image='https://res.theconcert.com/w_525,h_700,c_thumb/0137dad8ed592a2ab6f5c88eb9c45a65b/1.jpg' banner='https://siam2nite.media/PeDtmbzPkbVvyBFmONXnyWHzixU=/851x315/smart/events/20750/907ca0d189371f95d33384fbf8841a8d.jpg' description='This is the description aabbcc abc 1234' short_description='This short description abc 123' created=datetime.datetime(2021, 3, 11, 12, 0, 31, 90244, tzinfo=datetime.timezone.utc) public_key='ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIImwRyiIL1kKJd3ImTA/Y0ggdnT8J4XNr3ZEOwDKd2/s' private_key='-----BEGIN PRIVATE KEY-----\nMC4CAQAwBQYDK2VwBCIEIJRTkd/mFI2Wi00qXXbRjuN609tIll1oThzdUffW7FKs\n-----END PRIVATE KEY-----\n' >
@sakgunner pls review
impact None
test command
make reset
expect to run all setup script
make mock
expect to generate event data with public private key in a correct order
make test-worker
expect result tests/test_event.py::TestEvent::test_insert_event_key_success PASSED
test coverage ================================================================================== test session starts ================================================================================== platform linux -- Python 3.7.4, pytest-5.2.0, py-1.10.0, pluggy-0.13.1 -- /usr/local/bin/python cachedir: .pytest_cache rootdir: /usr/src plugins: aiohttp-0.3.0, cov-2.6.1, asyncio-0.10.0 collected 23 items
tests/test_event.py::TestEvent::test_insert_event_key_success PASSED [ 4%] tests/test_payment.py::TestPayment::test_create_payment_raise_error_should_not_creat_polling_payment_job PASSED [ 8%] tests/test_payment.py::TestPayment::test_create_payment_should_update_vat_and_pre_vat_price PASSED [ 13%] tests/test_payment.py::TestPayment::test_create_payment_success_should_create_polling_payment_job PASSED [ 17%] tests/test_payment.py::TestPayment::test_get_total_price_of_reservation PASSED [ 21%] tests/test_payment.py::TestPayment::test_other_payment_status_shoud_update_reservation_status PASSED [ 26%] tests/test_payment.py::TestPayment::test_payment_status_is_pending_should_create_new_job PASSED [ 30%] tests/test_payment.py::TestPayment::test_payment_status_paid_shoud_update_reservation_status PASSED [ 34%] tests/test_report.py::TestReport::test_insert_report_fail_no_id PASSED [ 39%] tests/test_report.py::TestReport::test_insert_report_success_first_running_number PASSED [ 43%] tests/test_report.py::TestReport::test_insert_report_success_second_running_number PASSED [ 47%] tests/test_reservation.py::TestReservation::test_cancel_reservation_should_update_status_to_expired_and_return_slot_state_of_reservation_id PASSED [ 52%] tests/test_reservation.py::TestReservation::test_cancel_reservation_with_status_paid_should_still_same_status PASSED [ 56%] tests/test_ticket.py::TestTicket::test_create_ticket_should_create_correctly_when_not_have_slots PASSED [ 60%] tests/test_ticket.py::TestTicket::test_generate_serial_number PASSED [ 65%] tests/test_ticket.py::TestTicket::test_generate_ticket_of_reservation PASSED [ 69%] tests/test_ticket.py::TestTicket::test_get_slot_state_table_name PASSED [ 73%] tests/test_ticket.py::TestTicket::test_get_tickets_data PASSED [ 78%] tests/test_ticket.py::TestTicket::test_return_all_slot_state_of_reservation PASSED [ 82%] tests/test_vat.py::TestVat::test_effective_vat_should_return_effective_vat PASSED [ 86%] tests/test_vat.py::TestVat::test_pre_vat_should_return_amount_exclude_vat_with_vat_7 PASSED [ 91%] tests/test_vat.py::TestVat::test_pre_vat_should_return_amount_exclude_vat_with_vat_7_and_decimal PASSED [ 95%] tests/test_vat.py::TestVat::test_pre_vat_should_return_amount_exclude_vat_with_vat_8 PASSED [100%]
----------- coverage: platform linux, python 3.7.4-final-0 ----------- Name Stmts Miss Cover Missing
conf.py 26 0 100% event.py 11 0 100% payment.py 48 0 100% report.py 30 0 100% reservation.py 8 0 100% tests/init.py 21 0 100% tests/test_event.py 22 0 100% tests/test_payment.py 80 4 95% 173-184 tests/test_report.py 28 0 100% tests/test_reservation.py 37 0 100% tests/test_ticket.py 59 0 100% tests/test_vat.py 29 0 100% ticket.py 55 4 93% 17-18, 28-29 utils/http.py 17 14 18% 5-12, 15-20 vat.py 7 0 100%
TOTAL 478 22 95%
================================================================================== 23 passed in 14.18s ==================================================================================