summaryrefslogtreecommitdiff
path: root/sql/modules/test/Company.sql
blob: 08b2f96b3ef12218c07d24d2f1aa1692d42374a3 (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. INSERT INTO test_result(test_name, success)
  36. SELECT 'Company_get_billing_info working', count(*) = 1
  37. FROM company_get_billing_info((select max(id) from entity_credit_account))
  38. WHERE control_code is not null;
  39. SELECT * FROM test_result;
  40. SELECT (select count(*) from test_result where success is true)
  41. || ' tests passed and '
  42. || (select count(*) from test_result where success is not true)
  43. || ' failed' as message;
  44. ROLLBACK;