Index: /trunk/glueforge/templates/psdb/insertfits_at.tt
===================================================================
--- /trunk/glueforge/templates/psdb/insertfits_at.tt	(revision 4283)
+++ /trunk/glueforge/templates/psdb/insertfits_at.tt	(revision 4283)
@@ -0,0 +1,15 @@
+AT_SETUP([[% namespace %]InsertFits() - Insert data from a binary FITS table [% object_name %] into the database])
+AT_KEYWORDS([[% namespace %]InsertFits])
+
+AT_CHECK([dbsetup])
+# run insert so there is a row in the table
+AT_CHECK([insert])
+# run popfis so there is afits file to read
+AT_CHECK([popfits])
+AT_CHECK([insertfits])
+AT_CHECK([dbcleanup])
+if [ test -f "blargh" ] ; then
+    rm -f "blargh"
+fi
+
+AT_CLEANUP
Index: /trunk/glueforge/templates/psdb/insertfits_c.tt
===================================================================
--- /trunk/glueforge/templates/psdb/insertfits_c.tt	(revision 4283)
+++ /trunk/glueforge/templates/psdb/insertfits_c.tt	(revision 4283)
@@ -0,0 +1,29 @@
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+
+int main ()
+{
+    psDB            *dbh;
+    psFits          *fits;
+
+    dbh = psDBInit("localhost", "test", NULL, "test");
+    if (!dbh) {
+        exit(EXIT_FAILURE);
+    }
+
+    // open a temp
+    fits = psFitsAlloc("./blargh");
+    if (!fits) {
+        exit(EXIT_FAILURE);
+    }
+
+    if (![% namespace %]InsertFits(dbh, fits)) {
+        exit(EXIT_FAILURE);
+    }
+
+    psFree(fits);
+    psDBCleanup(dbh);
+
+    exit(EXIT_SUCCESS);
+}
Index: /trunk/glueforge/templates/psdb/tests_makefile_am.tt
===================================================================
--- /trunk/glueforge/templates/psdb/tests_makefile_am.tt	(revision 4282)
+++ /trunk/glueforge/templates/psdb/tests_makefile_am.tt	(revision 4283)
@@ -54,4 +54,5 @@
     insertobject \
     popobject \
+    insertfits \
     popfits
 
Index: /trunk/glueforge/templates/psdb/testsuite_at.tt
===================================================================
--- /trunk/glueforge/templates/psdb/testsuite_at.tt	(revision 4282)
+++ /trunk/glueforge/templates/psdb/testsuite_at.tt	(revision 4283)
@@ -22,4 +22,6 @@
 [% INCLUDE popobject_at.tt %]
 ###
+[% INCLUDE insertfits_at.tt %]
+###
 [% INCLUDE popfits_at.tt %]
 ###
