summaryrefslogtreecommitdiff
path: root/sql/modules/test/Company.sql
blob: 7634b7ea865900b0b9517b8f77cf6ebd7528de5f (plain)
  1. BEGIN;
  2. \i Base.sql
  3. INSERT INTO test_result (test_name, success)
  4. SELECT 'Saving Company',
  5. company_save (NULL, 'TESTING...', 1,'TESTING', 'TESTING', NULL, '1234')
  6. IS NOT NULL;
  7. INSERT INTO test_result (test_name, success)
  8. SELECT 'Saving Credit Acct',
  9. entity_credit_save( NULL , 1, currval('entity_id_seq')::int, 'TEST', 0, false,
  10. 0, 0, 0, 'test-123', NULL, NULL, NULL, 'USD', now()::date, now()::date,
  11. 0, NULL, NULL)
  12. IS NOT NULL;
  13. INSERT INTO test_result (test_name, success)
  14. SELECT 'eca_location_save',
  15. eca__location_save(currval('entity_credit_account_id_seq')::int, NULL, 2, 'Test', 'Test',
  16. NULL, 'Test', 'Test', '12345', 25)
  17. IS NOT NULL;
  18. INSERT INTO test_result (test_name, success)
  19. SELECT 'eca_location_save returns same id with same args and no in_location_id',
  20. eca__location_save(currval('entity_credit_account_id_seq')::int, NULL, 1, 'Test2', 'Test',
  21. '', 'Test', 'Test', '12345', 25) =
  22. eca__location_save(currval('entity_credit_account_id_seq')::int, NULL, 2, 'Test2', 'Test',
  23. '', 'Test', 'Test', '12345', 25);
  24. INSERT INTO test_result (test_name, success)
  25. SELECT 'list_locations', count(*) = 3
  26. FROM eca__list_locations(currval('entity_credit_account_id_seq')::int);
  27. INSERT INTO test_result(test_name, success)
  28. SELECT 'saving eca contact',
  29. eca__save_contact(currval('entity_credit_account_id_seq')::int,
  30. 1, 'test_d', 'test_c', NULL, NULL) IS NOT NULL;
  31. INSERT INTO test_result(test_name, success)
  32. SELECT 'Contact found correctly', count(*) = 1
  33. FROM eca__list_contacts(currval('entity_credit_account_id_seq')::int)
  34. WHERE contact = 'test_c';
  35. SELECT * FROM test_result;
  36. SELECT (select count(*) from test_result where success is true)
  37. || ' tests passed and '
  38. || (select count(*) from test_result where success is not true)
  39. || ' failed' as message;
  40. ROLLBACK;