Index: tests/feedapi_mapper.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feedapi_mapper/tests/feedapi_mapper.test,v
retrieving revision 1.2.2.2
diff -u -p -r1.2.2.2 feedapi_mapper.test
--- tests/feedapi_mapper.test	12 Aug 2009 09:57:37 -0000	1.2.2.2
+++ tests/feedapi_mapper.test	17 Aug 2009 11:04:41 -0000
@@ -60,6 +60,42 @@ class FeedApiMapperBasicTestCase extends
     $this->drupalLogout();
   }
 
+  function testUserInterface() {
+    $this->drupalLogin($this->admin_user);
+    $this->enableParsers(TRUE, FALSE);
+    $options = array(
+      'typename' => 'story',
+      'filename' => 'drupal.xml',
+      'mappers' => array('node', 'feedapi_node'),
+      'mapping' => array(
+        serialize(array('title')) => serialize(array('node', 'title')),
+        serialize(array('description')) => serialize(array('node', 'body')),
+	serialize(array('options', 'timestamp')) => serialize(array('node', 'created')),
+        serialize(array('options', 'original_url')) => serialize(array('feedapi_node', 'original_url')),
+      ),
+    );
+    $feed_url = $this->setupFeed($options);
+    $this->drupalGet($feed_url . '/map');
+    $this->assertText('N/A', 'Some of the targets do not support unique bit.');
+    $this->assertText('No', 'One of the targets supports unique bit.');
+    $this->assertNoText('Yes', 'None of the targets marked unique yet.');
+    // Toggle unique bit
+    $this->clickLink('No');
+    $this->drupalGet($feed_url . '/map');
+    $this->assertText('Yes', 'One of the targets marked unique.');
+    // Checks via the database also
+    $mapper_entries = db_result(db_query("SELECT COUNT(*) FROM {feedapi_mapper}"));
+    $unique = unserialize(db_result(db_query("SELECT unique_elements FROM {feedapi_mapper}")));
+    $this->assertTrue($mapper_entries == 1, 'The mapping table contains one entry');
+    $this->assertTrue($unique[serialize(array('options', 'original_url'))], 'The mapping table contains that the URL is unique');
+
+    $mapper_entries = unserialize(db_result(db_query("SELECT mapping FROM {feedapi_mapper}")));
+    $this->assertTrue(count($mapper_entries == 4), 'Four mapping entries are defined.');
+    $this->clickLink('Delete');
+    $mapper_entries = unserialize(db_result(db_query("SELECT mapping FROM {feedapi_mapper}")));
+    $this->assertTrue(count($mapper_entries == 4), 'Three mapping entries are defined after one is deleted.');
+  }
+
   function _testDefaultMapping() {
     $options = array(
       'typename' => 'story',
