cvs diff: Diffing modules/update
Index: modules/update/update.test
===================================================================
RCS file: /Users/wright/drupal/local_repo/drupal/modules/update/update.test,v
retrieving revision 1.2
diff -u -p -r1.2 update.test
--- modules/update/update.test	27 Sep 2009 00:15:28 -0000	1.2
+++ modules/update/update.test	30 Sep 2009 01:14:22 -0000
@@ -3,14 +3,60 @@
 
 /**
  * @file
- * This file contains tests for the update module.
+ * This file contains tests for the update module. The overarching methodology
+ * of these tests is we need to compare a given state of installed modules and
+ * themes (e.g. version, project grouping, timestamps, etc) vs. a current
+ * state of what the release history XML files we fetch say is available.  We
+ * have dummy XML files (in the 'tests' subdirectory) that describe various
+ * scenarios of what's available for different test projects, and we have
+ * dummy .info file data (specified via hook_system_info_alter() in the
+ * update_test helper module) describing what's currently installed.  Each
+ * test case defines a set of projects to install, their current state (via
+ * the 'update_test_system_info' variable) and the desired availabile update
+ * data (via the 'update_test_xml_map' variable), and then performs a series
+ * of assertions that the report matches our expectations given the specific
+ * initial state and availability scenario.
  */
 
-class UpdateTestCase extends DrupalWebTestCase {
+/**
+ * Base class to define some shared functions used by all update tests.
+ */
+class UpdateTestHelper extends DrupalWebTestCase {
+  /**
+   * Refresh the update status based on the desired available update scenario.
+   *
+   * @param $xml_map
+   *   Array that maps project names to availability scenarios to fetch.
+   *   The key '#all' is used if a project-specific mapping is not defined.
+   *
+   * @see update_test_mock_page()
+   */
+  protected function refreshUpdateStatus($xml_map) {
+    // Tell update module to fetch from the URL provided by update_test module.
+    variable_set('update_fetch_url', url('update-test', array('absolute' => TRUE)));
+    // Save the map for update_test_mock_page() to use.
+    variable_set('update_test_xml_map', $xml_map);
+    // Manually check the update status.
+    $this->drupalGet('admin/reports/updates/check');
+  }
+
+  /**
+   * Run a series of assertions that are applicable for all update statuses.
+   */
+  protected function standardTests() {
+    $this->assertRaw('<h3>' . t('Drupal core') . '</h3>');
+    $this->assertRaw(l(t('Check manually'), 'admin/reports/updates/check'), t('Link to check available updates manually appears.'));
+    $this->assertRaw(l(t('Drupal'), 'http://example.com/project/drupal'), t('Link to the Drupal project appears.'));
+    $this->assertNoText(t('No available releases found'));
+  }
+
+}
+
+class UpdateCoreTestCase extends UpdateTestHelper {
 
   public static function getInfo() {
     return array(
-      'name' => 'Update functionality',
+      'name' => 'Update core functionality',
       'description' => 'Tests the update module through a series of functional tests using mock XML data.',
       'group' => 'Update',
     );
@@ -20,7 +66,6 @@ class UpdateTestCase extends DrupalWebTe
     parent::setUp('update_test', 'update');
     $admin_user = $this->drupalCreateUser(array('administer site configuration'));
     $this->drupalLogin($admin_user);
-    variable_set('update_fetch_url', url('update-test', array('absolute' => TRUE)));
   }
 
   /**
@@ -28,7 +73,7 @@ class UpdateTestCase extends DrupalWebTe
    */
   function testNoUpdatesAvailable() {
     $this->setSystemInfo7_0();
-    $this->refreshUpdateData('no-updates.xml');
+    $this->refreshUpdateStatus(array('drupal' => '7_0'));
     $this->drupalGet('admin/reports/updates');
     $this->standardTests();
     $this->assertText(t('Up to date'));
@@ -41,7 +86,7 @@ class UpdateTestCase extends DrupalWebTe
    */
   function testNormalUpdateAvailable() {
     $this->setSystemInfo7_0();
-    $this->refreshUpdateData('normal-update.xml');
+    $this->refreshUpdateStatus(array('drupal' => '7_1'));
     $this->drupalGet('admin/reports/updates');
     $this->standardTests();
     $this->assertNoText(t('Up to date'));
@@ -57,7 +102,7 @@ class UpdateTestCase extends DrupalWebTe
    */
   function testSecurityUpdateAvailable() {
     $this->setSystemInfo7_0();
-    $this->refreshUpdateData('security-update.xml');
+    $this->refreshUpdateStatus(array('drupal' => '7_2-sec'));
     $this->drupalGet('admin/reports/updates');
     $this->standardTests();
     $this->assertNoText(t('Up to date'));
@@ -84,7 +129,7 @@ class UpdateTestCase extends DrupalWebTe
       ),
     );
     variable_set('update_test_system_info', $system_info);
-    $this->refreshUpdateData('dev-snapshot.xml');
+    $this->refreshUpdateStatus(array('drupal' => 'dev'));
     $this->drupalGet('admin/reports/updates');
     $this->assertNoText(t('2001-Sep-'));
     $this->assertText(t('Up to date'));
@@ -92,18 +137,6 @@ class UpdateTestCase extends DrupalWebTe
     $this->assertNoText(t('Security update required!'));
   }
 
-  /**
-   * Helper function: force te update cache to refresh based on the contents of
-   * the specified XML file.
-   *
-   * @param $xml
-   *   The file name of the XML file to use for mock update data.
-   */
-  protected function refreshUpdateData($xml) {
-    variable_set('update_test_xml', $xml);
-    $this->drupalGet('admin/reports/updates/check');
-  }
-
   protected function setSystemInfo7_0() {
     $setting = array(
       '#all' => array(
@@ -113,12 +146,51 @@ class UpdateTestCase extends DrupalWebTe
     variable_set('update_test_system_info', $setting);
   }
 
+}
+
+class UpdateTestContribCase extends UpdateTestHelper {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Update contrib functionality',
+      'description' => 'Tests how the update module handles contributed modules and themes in a series of functional tests using mock XML data.',
+      'group' => 'Update',
+    );
+  }
+
+  function setUp() {
+    parent::setUp('update_test', 'update', 'aaa_update_test', 'bbb_update_test', 'ccc_update_test');
+    $admin_user = $this->drupalCreateUser(array('administer site configuration'));
+    $this->drupalLogin($admin_user);
+  }
+
   /**
-   * Helper function: run a series of assertions that are applicable for all
-   * update statuses.
+   * Test the basic functionality of a contrib module on the status report.
    */
-  protected function standardTests() {
-    $this->assertRaw(l(t('Check manually'), 'admin/reports/updates/check'), t('Link to check available updates manually appears.'));
-    $this->assertRaw(l(t('Drupal'), 'http://example.com/project/drupal'), t('Link to the Drupal project appears.'));
+  function testUpdateContribBasic() {
+    $system_info = array(
+      '#all' => array(
+        'version' => '7.0',
+      ),
+      'aaa_update_test' => array(
+        'project' => 'aaa_update_test',
+        'version' => '7.x-1.0',
+        'hidden' => FALSE,
+      ),
+    );
+    variable_set('update_test_system_info', $system_info);
+    $this->refreshUpdateStatus(
+      array(
+        'drupal' => '7_0',
+        'aaa_update_test' => '1_0',
+      )
+    );
+    $this->drupalGet('admin/reports/updates');
+    $this->standardTests();
+    $this->assertText(t('Up to date'));
+    $this->assertRaw('<h3>' . t('Modules') . '</h3>');
+    $this->assertNoText(t('Update available'));
+    $this->assertRaw(l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), t('Link to aaa_update_test project appears.'));
   }
 }
+
cvs diff: Diffing modules/update/tests
Index: modules/update/tests/aaa_update_test.1_0.xml
===================================================================
RCS file: modules/update/tests/aaa_update_test.1_0.xml
diff -N modules/update/tests/aaa_update_test.1_0.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/update/tests/aaa_update_test.1_0.xml	30 Sep 2009 01:02:20 -0000
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project xmlns:dc="http://purl.org/dc/elements/1.1/">
+<title>AAA Update test</title>
+<short_name>aaa_update_test</short_name>
+<dc:creator>Drupal</dc:creator>
+<api_version>7.x</api_version>
+<recommended_major>1</recommended_major>
+<supported_majors>1</supported_majors>
+<default_major>1</default_major>
+<project_status>published</project_status>
+<link>http://example.com/project/aaa_update_test</link>
+  <terms>
+   <term><name>Projects</name><value>Modules</value></term>
+  </terms>
+<releases>
+ <release>
+  <name>aaa_update_test 7.x-1.0</name>
+  <version>7.x-1.0</version>
+  <tag>DRUPAL-7--1-0</tag>
+  <version_major>1</version_major>
+  <version_patch>0</version_patch>
+  <status>published</status>
+  <release_link>http://example.com/aaa_update_test-7-x-1-0-release</release_link>
+  <download_link>http://example.com/aaa_update_test-7.x-1.0.tar.gz</download_link>
+  <date>1250424521</date>
+  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
+  <filesize>1073741824</filesize>
+  <terms>
+   <term><name>Release type</name><value>New features</value></term>
+   <term><name>Release type</name><value>Bug fixes</value></term>
+  </terms>
+ </release>
+</releases>
+</project>
Index: modules/update/tests/aaa_update_test.info
===================================================================
RCS file: modules/update/tests/aaa_update_test.info
diff -N modules/update/tests/aaa_update_test.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/update/tests/aaa_update_test.info	28 Sep 2009 19:56:20 -0000
@@ -0,0 +1,7 @@
+; $Id$
+name = AAA Update test
+description = Support module for update module testing.
+package = Testing
+core = 7.x
+files[] = aaa_update_test.module
+hidden = TRUE
Index: modules/update/tests/aaa_update_test.module
===================================================================
RCS file: modules/update/tests/aaa_update_test.module
diff -N modules/update/tests/aaa_update_test.module
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/update/tests/aaa_update_test.module	28 Sep 2009 19:50:42 -0000
@@ -0,0 +1,7 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Dummy module for testing Update status.
+ */
Index: modules/update/tests/bbb_update_test.1_0.xml
===================================================================
RCS file: modules/update/tests/bbb_update_test.1_0.xml
diff -N modules/update/tests/bbb_update_test.1_0.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/update/tests/bbb_update_test.1_0.xml	28 Sep 2009 19:50:42 -0000
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project xmlns:dc="http://purl.org/dc/elements/1.1/">
+<title>BBB Update test</title>
+<short_name>bbb_update_test</short_name>
+<dc:creator>Drupal</dc:creator>
+<api_version>7.x</api_version>
+<recommended_major>1</recommended_major>
+<supported_majors>1</supported_majors>
+<default_major>1</default_major>
+<project_status>published</project_status>
+<link>http://example.com/project/bbb_update_test</link>
+  <terms>
+   <term><name>Projects</name><value>Modules</value></term>
+  </terms>
+<releases>
+ <release>
+  <name>bbb_update_test 7.x-1.0</name>
+  <version>7.x-1.0</version>
+  <tag>DRUPAL-7--1-0</tag>
+  <version_major>1</version_major>
+  <version_patch>0</version_patch>
+  <status>published</status>
+  <release_link>http://example.com/bbb_update_test-7-x-1-0-release</release_link>
+  <download_link>http://example.com/bbb_update_test-7.x-1.0.tar.gz</download_link>
+  <date>1250424521</date>
+  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
+  <filesize>1073741824</filesize>
+  <terms>
+   <term><name>Release type</name><value>New features</value></term>
+   <term><name>Release type</name><value>Bug fixes</value></term>
+  </terms>
+ </release>
+</releases>
+</project>
Index: modules/update/tests/bbb_update_test.info
===================================================================
RCS file: modules/update/tests/bbb_update_test.info
diff -N modules/update/tests/bbb_update_test.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/update/tests/bbb_update_test.info	28 Sep 2009 19:56:07 -0000
@@ -0,0 +1,7 @@
+; $Id$
+name = BBB Update test
+description = Support module for update module testing.
+package = Testing
+core = 7.x
+files[] = bbb_update_test.module
+hidden = TRUE
Index: modules/update/tests/bbb_update_test.module
===================================================================
RCS file: modules/update/tests/bbb_update_test.module
diff -N modules/update/tests/bbb_update_test.module
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/update/tests/bbb_update_test.module	28 Sep 2009 19:50:42 -0000
@@ -0,0 +1,7 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Dummy module for testing Update status.
+ */
Index: modules/update/tests/ccc_update_test.1_0.xml
===================================================================
RCS file: modules/update/tests/ccc_update_test.1_0.xml
diff -N modules/update/tests/ccc_update_test.1_0.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/update/tests/ccc_update_test.1_0.xml	28 Sep 2009 19:50:42 -0000
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project xmlns:dc="http://purl.org/dc/elements/1.1/">
+<title>CCC Update test</title>
+<short_name>ccc_update_test</short_name>
+<dc:creator>Drupal</dc:creator>
+<api_version>7.x</api_version>
+<recommended_major>1</recommended_major>
+<supported_majors>1</supported_majors>
+<default_major>1</default_major>
+<project_status>published</project_status>
+<link>http://example.com/project/ccc_update_test</link>
+  <terms>
+   <term><name>Projects</name><value>Modules</value></term>
+  </terms>
+<releases>
+ <release>
+  <name>ccc_update_test 7.x-1.0</name>
+  <version>7.x-1.0</version>
+  <tag>DRUPAL-7--1-0</tag>
+  <version_major>1</version_major>
+  <version_patch>0</version_patch>
+  <status>published</status>
+  <release_link>http://example.com/ccc_update_test-7-x-1-0-release</release_link>
+  <download_link>http://example.com/ccc_update_test-7.x-1.0.tar.gz</download_link>
+  <date>1250424521</date>
+  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
+  <filesize>1073741824</filesize>
+  <terms>
+   <term><name>Release type</name><value>New features</value></term>
+   <term><name>Release type</name><value>Bug fixes</value></term>
+  </terms>
+ </release>
+</releases>
+</project>
Index: modules/update/tests/ccc_update_test.info
===================================================================
RCS file: modules/update/tests/ccc_update_test.info
diff -N modules/update/tests/ccc_update_test.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/update/tests/ccc_update_test.info	28 Sep 2009 19:56:03 -0000
@@ -0,0 +1,7 @@
+; $Id$
+name = CCC Update test
+description = Support module for update module testing.
+package = Testing
+core = 7.x
+files[] = ccc_update_test.module
+hidden = TRUE
Index: modules/update/tests/ccc_update_test.module
===================================================================
RCS file: modules/update/tests/ccc_update_test.module
diff -N modules/update/tests/ccc_update_test.module
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/update/tests/ccc_update_test.module	28 Sep 2009 19:50:42 -0000
@@ -0,0 +1,7 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Dummy module for testing Update status.
+ */
Index: modules/update/tests/dev-snapshot.xml
===================================================================
RCS file: modules/update/tests/dev-snapshot.xml
diff -N modules/update/tests/dev-snapshot.xml
--- modules/update/tests/dev-snapshot.xml	27 Sep 2009 00:15:28 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<project xmlns:dc="http://purl.org/dc/elements/1.1/">
-<title>Drupal</title>
-<short_name>drupal</short_name>
-<dc:creator>Drupal</dc:creator>
-<api_version>7.x</api_version>
-<recommended_major>7</recommended_major>
-<supported_majors>7</supported_majors>
-<default_major>7</default_major>
-<project_status>published</project_status>
-<link>http://example.com/project/drupal</link>
-  <terms>
-   <term><name>Projects</name><value>Drupal project</value></term>
-  </terms>
-<releases>
- <release>
-  <name>Drupal 7.0</name>
-  <version>7.0</version>
-  <tag>DRUPAL-7-0</tag>
-  <version_major>7</version_major>
-  <version_patch>0</version_patch>
-  <status>published</status>
-  <release_link>http://example.com/drupal-7-0-release</release_link>
-  <download_link>http://example.com/drupal-7-0.tar.gz</download_link>
-  <date>1250424521</date>
-  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
-  <filesize>1073741824</filesize>
-  <terms>
-   <term><name>Release type</name><value>New features</value></term>
-   <term><name>Release type</name><value>Bug fixes</value></term>
-  </terms>
- </release>
- <release>
-  <name>Drupal 7.x-dev</name>
-  <version>7.x-dev</version>
-  <tag>DRUPAL-7</tag>
-  <version_major>7</version_major>
-  <version_extra>dev</version_extra>
-  <status>published</status>
-  <release_link>http://example.com/drupal-7-x-dev-release</release_link>
-  <download_link>http://example.com/drupal-7.x-dev.tar.gz</download_link>
-  <date>1250424581</date>
-  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
-  <filesize>2147483648</filesize>
-  <terms>
-   <term><name>Release type</name><value>Bug fixes</value></term>
-  </terms>
- </release>
-</releases>
-</project>
Index: modules/update/tests/drupal.7_0.xml
===================================================================
RCS file: modules/update/tests/drupal.7_0.xml
diff -N modules/update/tests/drupal.7_0.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/update/tests/drupal.7_0.xml	29 Sep 2009 16:56:26 -0000
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project xmlns:dc="http://purl.org/dc/elements/1.1/">
+<title>Drupal</title>
+<short_name>drupal</short_name>
+<dc:creator>Drupal</dc:creator>
+<api_version>7.x</api_version>
+<recommended_major>7</recommended_major>
+<supported_majors>7</supported_majors>
+<default_major>7</default_major>
+<project_status>published</project_status>
+<link>http://example.com/project/drupal</link>
+  <terms>
+   <term><name>Projects</name><value>Drupal project</value></term>
+  </terms>
+<releases>
+ <release>
+  <name>Drupal 7.0</name>
+  <version>7.0</version>
+  <tag>DRUPAL-7-0</tag>
+  <version_major>7</version_major>
+  <version_patch>0</version_patch>
+  <status>published</status>
+  <release_link>http://example.com/drupal-7-0-release</release_link>
+  <download_link>http://example.com/drupal-7-0.tar.gz</download_link>
+  <date>1250424521</date>
+  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
+  <filesize>1073741824</filesize>
+  <terms>
+   <term><name>Release type</name><value>New features</value></term>
+   <term><name>Release type</name><value>Bug fixes</value></term>
+  </terms>
+ </release>
+</releases>
+</project>
Index: modules/update/tests/drupal.7_1.xml
===================================================================
RCS file: modules/update/tests/drupal.7_1.xml
diff -N modules/update/tests/drupal.7_1.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/update/tests/drupal.7_1.xml	29 Sep 2009 16:56:26 -0000
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project xmlns:dc="http://purl.org/dc/elements/1.1/">
+<title>Drupal</title>
+<short_name>drupal</short_name>
+<dc:creator>Drupal</dc:creator>
+<api_version>7.x</api_version>
+<recommended_major>7</recommended_major>
+<supported_majors>7</supported_majors>
+<default_major>7</default_major>
+<project_status>published</project_status>
+<link>http://example.com/project/drupal</link>
+  <terms>
+   <term><name>Projects</name><value>Drupal project</value></term>
+  </terms>
+<releases>
+ <release>
+  <name>Drupal 7.1</name>
+  <version>7.1</version>
+  <tag>DRUPAL-7-1</tag>
+  <version_major>7</version_major>
+  <version_patch>1</version_patch>
+  <status>published</status>
+  <release_link>http://example.com/drupal-7-1-release</release_link>
+  <download_link>http://example.com/drupal-7-1.tar.gz</download_link>
+  <date>1250424581</date>
+  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
+  <filesize>2147483648</filesize>
+  <terms>
+   <term><name>Release type</name><value>New features</value></term>
+   <term><name>Release type</name><value>Bug fixes</value></term>
+  </terms>
+ </release>
+ <release>
+  <name>Drupal 7.0</name>
+  <version>7.0</version>
+  <tag>DRUPAL-7-0</tag>
+  <version_major>7</version_major>
+  <version_patch>0</version_patch>
+  <status>published</status>
+  <release_link>http://example.com/drupal-7-0-release</release_link>
+  <download_link>http://example.com/drupal-7-0.tar.gz</download_link>
+  <date>1250424521</date>
+  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
+  <filesize>1073741824</filesize>
+  <terms>
+   <term><name>Release type</name><value>New features</value></term>
+   <term><name>Release type</name><value>Bug fixes</value></term>
+  </terms>
+ </release>
+</releases>
+</project>
Index: modules/update/tests/drupal.7_2-sec.xml
===================================================================
RCS file: modules/update/tests/drupal.7_2-sec.xml
diff -N modules/update/tests/drupal.7_2-sec.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/update/tests/drupal.7_2-sec.xml	29 Sep 2009 16:56:26 -0000
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project xmlns:dc="http://purl.org/dc/elements/1.1/">
+<title>Drupal</title>
+<short_name>drupal</short_name>
+<dc:creator>Drupal</dc:creator>
+<api_version>7.x</api_version>
+<recommended_major>7</recommended_major>
+<supported_majors>7</supported_majors>
+<default_major>7</default_major>
+<project_status>published</project_status>
+<link>http://example.com/project/drupal</link>
+  <terms>
+   <term><name>Projects</name><value>Drupal project</value></term>
+  </terms>
+<releases>
+ <release>
+  <name>Drupal 7.2</name>
+  <version>7.2</version>
+  <tag>DRUPAL-7-2</tag>
+  <version_major>7</version_major>
+  <version_patch>2</version_patch>
+  <status>published</status>
+  <release_link>http://example.com/drupal-7-2-release</release_link>
+  <download_link>http://example.com/drupal-7-2.tar.gz</download_link>
+  <date>1250424641</date>
+  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
+  <filesize>4294967296</filesize>
+  <terms>
+   <term><name>Release type</name><value>New features</value></term>
+   <term><name>Release type</name><value>Bug fixes</value></term>
+   <term><name>Release type</name><value>Security update</value></term>
+  </terms>
+ </release>
+ <release>
+  <name>Drupal 7.1</name>
+  <version>7.1</version>
+  <tag>DRUPAL-7-1</tag>
+  <version_major>7</version_major>
+  <version_patch>1</version_patch>
+  <status>published</status>
+  <release_link>http://example.com/drupal-7-1-release</release_link>
+  <download_link>http://example.com/drupal-7-1.tar.gz</download_link>
+  <date>1250424581</date>
+  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
+  <filesize>2147483648</filesize>
+  <terms>
+   <term><name>Release type</name><value>New features</value></term>
+   <term><name>Release type</name><value>Bug fixes</value></term>
+  </terms>
+ </release>
+ <release>
+  <name>Drupal 7.0</name>
+  <version>7.0</version>
+  <tag>DRUPAL-7-0</tag>
+  <version_major>7</version_major>
+  <version_patch>0</version_patch>
+  <status>published</status>
+  <release_link>http://example.com/drupal-7-0-release</release_link>
+  <download_link>http://example.com/drupal-7-0.tar.gz</download_link>
+  <date>1250424521</date>
+  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
+  <filesize>1073741824</filesize>
+  <terms>
+   <term><name>Release type</name><value>New features</value></term>
+   <term><name>Release type</name><value>Bug fixes</value></term>
+  </terms>
+ </release>
+</releases>
+</project>
Index: modules/update/tests/drupal.dev.xml
===================================================================
RCS file: modules/update/tests/drupal.dev.xml
diff -N modules/update/tests/drupal.dev.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/update/tests/drupal.dev.xml	29 Sep 2009 16:56:26 -0000
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project xmlns:dc="http://purl.org/dc/elements/1.1/">
+<title>Drupal</title>
+<short_name>drupal</short_name>
+<dc:creator>Drupal</dc:creator>
+<api_version>7.x</api_version>
+<recommended_major>7</recommended_major>
+<supported_majors>7</supported_majors>
+<default_major>7</default_major>
+<project_status>published</project_status>
+<link>http://example.com/project/drupal</link>
+  <terms>
+   <term><name>Projects</name><value>Drupal project</value></term>
+  </terms>
+<releases>
+ <release>
+  <name>Drupal 7.0</name>
+  <version>7.0</version>
+  <tag>DRUPAL-7-0</tag>
+  <version_major>7</version_major>
+  <version_patch>0</version_patch>
+  <status>published</status>
+  <release_link>http://example.com/drupal-7-0-release</release_link>
+  <download_link>http://example.com/drupal-7-0.tar.gz</download_link>
+  <date>1250424521</date>
+  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
+  <filesize>1073741824</filesize>
+  <terms>
+   <term><name>Release type</name><value>New features</value></term>
+   <term><name>Release type</name><value>Bug fixes</value></term>
+  </terms>
+ </release>
+ <release>
+  <name>Drupal 7.x-dev</name>
+  <version>7.x-dev</version>
+  <tag>DRUPAL-7</tag>
+  <version_major>7</version_major>
+  <version_extra>dev</version_extra>
+  <status>published</status>
+  <release_link>http://example.com/drupal-7-x-dev-release</release_link>
+  <download_link>http://example.com/drupal-7.x-dev.tar.gz</download_link>
+  <date>1250424581</date>
+  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
+  <filesize>2147483648</filesize>
+  <terms>
+   <term><name>Release type</name><value>Bug fixes</value></term>
+  </terms>
+ </release>
+</releases>
+</project>
Index: modules/update/tests/no-updates.xml
===================================================================
RCS file: modules/update/tests/no-updates.xml
diff -N modules/update/tests/no-updates.xml
--- modules/update/tests/no-updates.xml	26 Sep 2009 17:03:13 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<project xmlns:dc="http://purl.org/dc/elements/1.1/">
-<title>Drupal</title>
-<short_name>drupal</short_name>
-<dc:creator>Drupal</dc:creator>
-<api_version>7.x</api_version>
-<recommended_major>7</recommended_major>
-<supported_majors>7</supported_majors>
-<default_major>7</default_major>
-<project_status>published</project_status>
-<link>http://example.com/project/drupal</link>
-  <terms>
-   <term><name>Projects</name><value>Drupal project</value></term>
-  </terms>
-<releases>
- <release>
-  <name>Drupal 7.0</name>
-  <version>7.0</version>
-  <tag>DRUPAL-7-0</tag>
-  <version_major>7</version_major>
-  <version_patch>0</version_patch>
-  <status>published</status>
-  <release_link>http://example.com/drupal-7-0-release</release_link>
-  <download_link>http://example.com/drupal-7-0.tar.gz</download_link>
-  <date>1250424521</date>
-  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
-  <filesize>1073741824</filesize>
-  <terms>
-   <term><name>Release type</name><value>New features</value></term>
-   <term><name>Release type</name><value>Bug fixes</value></term>
-  </terms>
- </release>
-</releases>
-</project>
Index: modules/update/tests/normal-update.xml
===================================================================
RCS file: modules/update/tests/normal-update.xml
diff -N modules/update/tests/normal-update.xml
--- modules/update/tests/normal-update.xml	26 Sep 2009 17:03:13 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<project xmlns:dc="http://purl.org/dc/elements/1.1/">
-<title>Drupal</title>
-<short_name>drupal</short_name>
-<dc:creator>Drupal</dc:creator>
-<api_version>7.x</api_version>
-<recommended_major>7</recommended_major>
-<supported_majors>7</supported_majors>
-<default_major>7</default_major>
-<project_status>published</project_status>
-<link>http://example.com/project/drupal</link>
-  <terms>
-   <term><name>Projects</name><value>Drupal project</value></term>
-  </terms>
-<releases>
- <release>
-  <name>Drupal 7.1</name>
-  <version>7.1</version>
-  <tag>DRUPAL-7-1</tag>
-  <version_major>7</version_major>
-  <version_patch>1</version_patch>
-  <status>published</status>
-  <release_link>http://example.com/drupal-7-1-release</release_link>
-  <download_link>http://example.com/drupal-7-1.tar.gz</download_link>
-  <date>1250424581</date>
-  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
-  <filesize>2147483648</filesize>
-  <terms>
-   <term><name>Release type</name><value>New features</value></term>
-   <term><name>Release type</name><value>Bug fixes</value></term>
-  </terms>
- </release>
- <release>
-  <name>Drupal 7.0</name>
-  <version>7.0</version>
-  <tag>DRUPAL-7-0</tag>
-  <version_major>7</version_major>
-  <version_patch>0</version_patch>
-  <status>published</status>
-  <release_link>http://example.com/drupal-7-0-release</release_link>
-  <download_link>http://example.com/drupal-7-0.tar.gz</download_link>
-  <date>1250424521</date>
-  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
-  <filesize>1073741824</filesize>
-  <terms>
-   <term><name>Release type</name><value>New features</value></term>
-   <term><name>Release type</name><value>Bug fixes</value></term>
-  </terms>
- </release>
-</releases>
-</project>
Index: modules/update/tests/security-update.xml
===================================================================
RCS file: modules/update/tests/security-update.xml
diff -N modules/update/tests/security-update.xml
--- modules/update/tests/security-update.xml	26 Sep 2009 17:03:13 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<project xmlns:dc="http://purl.org/dc/elements/1.1/">
-<title>Drupal</title>
-<short_name>drupal</short_name>
-<dc:creator>Drupal</dc:creator>
-<api_version>7.x</api_version>
-<recommended_major>7</recommended_major>
-<supported_majors>7</supported_majors>
-<default_major>7</default_major>
-<project_status>published</project_status>
-<link>http://example.com/project/drupal</link>
-  <terms>
-   <term><name>Projects</name><value>Drupal project</value></term>
-  </terms>
-<releases>
- <release>
-  <name>Drupal 7.2</name>
-  <version>7.2</version>
-  <tag>DRUPAL-7-2</tag>
-  <version_major>7</version_major>
-  <version_patch>2</version_patch>
-  <status>published</status>
-  <release_link>http://example.com/drupal-7-2-release</release_link>
-  <download_link>http://example.com/drupal-7-2.tar.gz</download_link>
-  <date>1250424641</date>
-  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
-  <filesize>4294967296</filesize>
-  <terms>
-   <term><name>Release type</name><value>New features</value></term>
-   <term><name>Release type</name><value>Bug fixes</value></term>
-   <term><name>Release type</name><value>Security update</value></term>
-  </terms>
- </release>
- <release>
-  <name>Drupal 7.1</name>
-  <version>7.1</version>
-  <tag>DRUPAL-7-1</tag>
-  <version_major>7</version_major>
-  <version_patch>1</version_patch>
-  <status>published</status>
-  <release_link>http://example.com/drupal-7-1-release</release_link>
-  <download_link>http://example.com/drupal-7-1.tar.gz</download_link>
-  <date>1250424581</date>
-  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
-  <filesize>2147483648</filesize>
-  <terms>
-   <term><name>Release type</name><value>New features</value></term>
-   <term><name>Release type</name><value>Bug fixes</value></term>
-  </terms>
- </release>
- <release>
-  <name>Drupal 7.0</name>
-  <version>7.0</version>
-  <tag>DRUPAL-7-0</tag>
-  <version_major>7</version_major>
-  <version_patch>0</version_patch>
-  <status>published</status>
-  <release_link>http://example.com/drupal-7-0-release</release_link>
-  <download_link>http://example.com/drupal-7-0.tar.gz</download_link>
-  <date>1250424521</date>
-  <mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
-  <filesize>1073741824</filesize>
-  <terms>
-   <term><name>Release type</name><value>New features</value></term>
-   <term><name>Release type</name><value>Bug fixes</value></term>
-  </terms>
- </release>
-</releases>
-</project>
Index: modules/update/tests/update_test.module
===================================================================
RCS file: /Users/wright/drupal/local_repo/drupal/modules/update/tests/update_test.module,v
retrieving revision 1.1
diff -u -p -r1.1 update_test.module
--- modules/update/tests/update_test.module	26 Sep 2009 17:03:13 -0000	1.1
+++ modules/update/tests/update_test.module	29 Sep 2009 17:15:55 -0000
@@ -41,10 +41,30 @@ function update_test_system_info_alter(&
 
 /**
  * Page callback, prints mock XML for the update module.
+ *
+ * The specific XML file to print depends on two things: the project we're
+ * trying to fetch data for, and the desired "availability scenario" for that
+ * project which we're trying to test. Before attempting to fetch this data
+ * (by checking for updates on the available updates report), callers need to
+ * define the 'update_test_xml_map' variable as an array, keyed by project
+ * name, indicating which availability scenario to use for that project.
+ *
+ * @param $project_name
+ *   The project short name update.module is trying to fetch data for (the
+ *   fetch URLs are of the form: [base_url]/[project_name]/[core_version]).
  */
-function update_test_mock_page() {
-  $xml = variable_get('update_test_xml', FALSE);
-  // Note: this will cause an exception to occur if no variable was set and
-  // $file is FALSE.
-  readfile(drupal_get_path('module', 'update_test') . "/$xml");
+function update_test_mock_page($project_name) {
+  $xml_map = variable_get('update_test_xml_map', FALSE);
+  if (!empty($xml_map[$project_name])) {
+    $availability_scenario = $xml_map[$project_name];
+  }
+  elseif (!empty($xml_map['#all'])) {
+    $availability_scenario = $xml_map['#all'];
+  }
+  else {
+    return FALSE;
+  }
+
+  $path = drupal_get_path('module', 'update_test');
+  readfile("$path/$project_name.$availability_scenario.xml");
 }
