changeset:   36:37c8dab4155f
tag:         tip
user:        root@lenny
date:        Wed Nov 04 19:05:44 2009 +0100
files:       usr/src/ShindigIntegrator/shindig_integrator/shindig_integrator.module usr/src/ShindigIntegrator/shindig_integrator/shindig_integrator.test
description:
fix duplicate field in save_application, gadget height bug


diff -r e3da15165432 -r 37c8dab4155f usr/src/ShindigIntegrator/shindig_integrator/shindig_integrator.module
--- a/usr/src/ShindigIntegrator/shindig_integrator/shindig_integrator.module	Wed Nov 04 18:11:49 2009 +0100
+++ b/usr/src/ShindigIntegrator/shindig_integrator/shindig_integrator.module	Wed Nov 04 19:05:44 2009 +0100
@@ -444,7 +444,7 @@
         $info['author_email'], $info['description'], $info['settings'], 
         $info['version'], $info['height'], $info['scrolling'],  
         $info['modified'], $info['url'], $info['title'], 
-        $info['directory_title'], $info['screenshot'], $info['screenshot'], 
+        $info['directory_title'], $info['screenshot'],
         $info['thumbnail'], $info['author'], $info['author_email'], 
         $info['description'], $info['settings'], $info['version'], 
         $info['height'], $info['scrolling'], $info['modified']);
@@ -473,6 +473,9 @@
  *  Gadget's data in json decoded string
  */
 function fetch_gadget_metadata($app_url) {
+  if (function_exists("fetch_gadget_metadata_mockup") == TRUE) {
+    return json_decode(fetch_gadget_metadata_mockup($app_url));
+  }
   $path_shindig = drupal_get_path('module', 'shindig_integrator');
   module_load_include('php', 'shindig_integrator', '/shindig/php/config/local');
   $request = json_encode(
diff -r e3da15165432 -r 37c8dab4155f usr/src/ShindigIntegrator/shindig_integrator/shindig_integrator.test
--- a/usr/src/ShindigIntegrator/shindig_integrator/shindig_integrator.test	Wed Nov 04 18:11:49 2009 +0100
+++ b/usr/src/ShindigIntegrator/shindig_integrator/shindig_integrator.test	Wed Nov 04 19:05:44 2009 +0100
@@ -8,6 +8,10 @@
  *
  */
 
+function fetch_gadget_metadata_mockup($app_url) {
+  return '{ "gadgets": [{"url": "http://dummyapplication/", "scrolling": true, "iframeUrl": "dummyiframeUrl" , "height": 600}]}';
+}
+
 class ShindigIntegratorTestCase extends DrupalWebTestCase {
   /**
    * Implementation of getInfo().
@@ -54,4 +58,10 @@
     $field = db_fetch_object(db_query("SELECT * FROM {profile_fields} where name = 'profile_interest'"));
     $this->assertEqual($field->title, 'Interested in');
   }
+
+  function test_save_application() {
+    $result = save_application("http://dummyapplication/");
+    $app = db_fetch_object(db_query("SELECT * FROM {applications} where url = 'http://dummyapplication/'"));
+    $this->assertEqual($app->height, 600);
+  }
 }
\ No newline at end of file

