[Fusionforge-commits] FusionForge branch master updated. de3e0f5c0acae096e5ec754c803eb16a7a75de8c

Roland Mas lolando at fusionforge.org
Fri Dec 5 11:38:44 CET 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  de3e0f5c0acae096e5ec754c803eb16a7a75de8c (commit)
       via  298538e2f4182a5703867b0303526863cd749cd0 (commit)
       via  7676483912b599f52642a4a298e7b925628d7cb0 (commit)
       via  d8117d0f63b3a13437aceec51b2f2d4d6c59bda2 (commit)
       via  55b47f0823b9244027b73f60920109d60e1a7a98 (commit)
      from  7fd1f7059018775e4ba27f81ded1edfab83f87ed (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit de3e0f5c0acae096e5ec754c803eb16a7a75de8c
Merge: 7fd1f70 298538e
Author: Roland Mas <lolando at debian.org>
Date:   Fri Dec 5 11:27:15 2014 +0100

    Merge branch 'feature/updated-testsuite-for-soap'


commit 298538e2f4182a5703867b0303526863cd749cd0
Author: Roland Mas <lolando at debian.org>
Date:   Wed Dec 3 17:27:27 2014 +0100

    Stop using deprecated HTTP_RAW_POST_DATA variable

diff --git a/src/www/soap/index.php b/src/www/soap/index.php
index e29d5a5..d7b9b10 100644
--- a/src/www/soap/index.php
+++ b/src/www/soap/index.php
@@ -191,8 +191,8 @@ function version() {
 }
 
 // 4. call the service method to initiate the transaction and send the response
-$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
-$server->service($HTTP_RAW_POST_DATA);
+$postdata = file_get_contents("php://input");
+$server->service($postdata);
 
 if(isset($log) and $log != ''){
 	harness('nusoap_r2_base_server',$server->headers['User-Agent'],$server->methodname,$server->request,$server->response,$server->result);

commit 7676483912b599f52642a4a298e7b925628d7cb0
Author: Roland Mas <lolando at debian.org>
Date:   Wed Dec 3 18:16:27 2014 +0100

    Removed old SOAP testsuite

diff --git a/tests/func/Soap/soapTest.php b/tests/func/70_SOAP/soapTest.php
similarity index 100%
rename from tests/func/Soap/soapTest.php
rename to tests/func/70_SOAP/soapTest.php
diff --git a/tests/func/Soap/AllTests.php b/tests/func/Soap/AllTests.php
deleted file mode 100644
index 7c7e5a7..0000000
--- a/tests/func/Soap/AllTests.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/*
- * Copyright (C) 2008 Alain Peyrat <aljeux at free.fr>
- * Copyright (C) 2009 Alain Peyrat, Alcatel-Lucent
- * Copyright (c) 2009 Olivier Berger, Institut Télécom
- *
- * This file is part of FusionForge.
- *
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * FusionForge is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/*
- * Standard Alcatel-Lucent disclaimer for contributing to open source
- *
- * "The test suite ("Contribution") has not been tested and/or
- * validated for release as or in products, combinations with products or
- * other commercial use. Any use of the Contribution is entirely made at
- * the user's own responsibility and the user can not rely on any features,
- * functionalities or performances Alcatel-Lucent has attributed to the
- * Contribution.
- *
- * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
- * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
- * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
- * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
- * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
- * ALONE BASIS."
- */
-
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Site_AllTests::main');
-}
-
-if (!@include_once 'PHPUnit/Autoload.php') {
-	include_once 'PHPUnit/Framework.php';
-	require_once 'PHPUnit/TextUI/TestRunner.php';
-}
-
-require_once 'func/config.php';
-require_once 'func/Soap/checks.php';
-require_once 'func/Soap/login.php';
-require_once 'func/Soap/usergroup.php';
-
-class Soap_AllTests
-{
-    public static function main()
-    {
-        PHPUnit_TextUI_TestRunner::run(self::suite());
-    }
-
-    public static function suite()
-    {
-        $suite = new PHPUnit_Framework_TestSuite('PHPUnit Framework');
-
-        $suite->addTestSuite('SoapChecksProcess');
-	$suite->addTestSuite('SoapLoginProcess');
-	$suite->addTestSuite('SoapUserGroupProcess');
-
-        return $suite;
-    }
-}
-
-if (PHPUnit_MAIN_METHOD == 'Soap_AllTests::main') {
-    Soap_AllTests::main();
-}
diff --git a/tests/func/Soap/checks.php b/tests/func/Soap/checks.php
deleted file mode 100644
index 289da9a..0000000
--- a/tests/func/Soap/checks.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-/*
- * Copyright (C) 2009 Olivier Berger, Institut TELECOM
- *
- * This file is part of FusionForge.
- *
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * FusionForge is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-require_once 'PHPUnit/Framework/TestCase.php';
-
-class SoapChecksProcess extends PHPUnit_Framework_TestCase
-{
-  // Check that the SOAP API server corresponds to a hostname that
-  // resolves otherwise, phpunit fails with error code 255 on
-  // SoapClient instanciation with WSDL ... strange
-  // This assumes that upon failure, the hostname is returned instead
-  // of the IP.
-  function testHostnameResolves()
-  {
-
-    $ip = gethostbyname(HOST);
-    $this->assertNotEquals(HOST, $ip);
-
-  }
-
-  // This checks that the login will be able to proceed as the test
-  // environment was configured the right way
-  function testExistingUserPasswordConfigured()
-  {
-
-    $this->assertNotEquals('xxxxx', FORGE_ADMIN_PASSWORD);
-
-  }
-
-  // This checks that the WSDL URL looks fine
-  function testWSDLUrl()
-  {
-    $this->assertRegExp('/^http.?:\/\//', WSDL_URL);
-  }
-
-}
diff --git a/tests/func/Soap/login.php b/tests/func/Soap/login.php
deleted file mode 100644
index a26058c..0000000
--- a/tests/func/Soap/login.php
+++ /dev/null
@@ -1,216 +0,0 @@
-<?php
-/*
- * Copyright (C) 2009 Olivier Berger, Institut TELECOM
- *
- * This file is part of FusionForge.
- *
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * FusionForge is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-require_once 'PHPUnit/Framework/TestCase.php';
-
-class SoapLoginProcess extends PHPUnit_Framework_TestCase
-{
-
-	function setUp()
-	{
-
-	  //	  print_r("setup\n");
-
-	  $this->session = NULL;
-	  $this->soapclient = NULL;
-
-	  //try {
-
-	  // This is to check that the SoapClient instanciation will
-	  // work. There's aparently a different behaviour if
-	  // resolving the hostname doesn't work under phpunit. If
-	  // this fails, the hostname and IP address should be
-	  // different and the WSDL retrieval should work
-	  $ip = gethostbyname(HOST);
-	  if ($ip != HOST)
-	    {
-
-	      // Instantiate the SOAP client with WSDL
-	      $this->soapclient = new SoapClient(WSDL_URL,
-					     array('cache_wsdl' => WSDL_CACHE_NONE,
-						   'trace' => true));
-
-	  //	  } catch (SoapFault $fault) {
-	  //	    $fault->faultstring;
-	  //	    print_r($fault);
-	  //	  }
-	      //	      print_r($this->soapclient);
-	    }
-
-	}
-
-	 function tearDown()
-	 {
-	   if ($this->session) {
-	     $response = $this->soapclient->logout($this->session);
-	     //	     print($response);
-	   }
-	 }
-
-
-	// performs a login and returns a session "cookie"
-	function login($userid, $passwd)
-	{
-	  $this->assertNotNull($this->soapclient);
-
-	  $response = $this->soapclient->login($userid, $passwd);
-
-	  if ($response) {
-	    $this->session = $response;
-	    //	    print_r($this->session);
-	  }
-
-	  return $response;
-	}
-
-	// Name: version
-	// Binding: GForgeAPIBinding
-	// Input:
-	//   use: encoded
-	//   message: versionRequest
-	//   parts:
-	// Output:
-	//   use: encoded
-	//   message: versionResponse
-	//   parts:
-	//     versionResponse: xsd:string
-
-	function testVersion()
-	{
-	  $this->assertNotNull($this->soapclient);
-
-	  $version = $this->soapclient->version();
-
-	  $this->assertEquals('4.8.50', $version);
-
-	}
-
-        /**
-	 * @depends testVersion
-	 */
-	function testGETFUNCTIONS()
-	{
-	  $this->assertNotNull($this->soapclient);
-	  $response = $this->soapclient->__getFunctions();
-	  //	  print_r($response);
-	}
-
-	// Name: login
-	// Binding: GForgeAPIBinding
-	// Input:
-	//   use: encoded
-	//   message: loginRequest
-	//   parts:
-	//     userid: xsd:string
-	//     passwd: xsd:string
-	// Output:
-	//   use: encoded
-	//   message: loginResponse
-	//   parts:
-	//     loginResponse: xsd:string
-
-        /**
-	 * @depends testVersion
-	 */
-	function testLoginNonExistantUser()
-	{
-	  $this->assertNotNull($this->soapclient);
-
-	  $userid = 'coin';
-
-	  try {
-	    $response = $this->soapclient->login($userid, 'pan');
-	  }
-	  catch (SoapFault $expected) {
-
-	    $this->assertEquals("Unable to log in with userid of ".$userid, $expected->faultstring);
-	    //	    print_r($response);
-	    return;
-	  }
-
-	  $this->fail('An expected exception has not been raised.');
-	}
-
-        /**
-	 * @depends testVersion
-	 */
-	function testLoginWrongPwd()
-	{
-	  $this->assertNotNull($this->soapclient);
-
-	  $userid = FORGE_ADMIN_USERNAME;
-
-	  try {
-	    $response = $this->soapclient->login($userid, 'xxxxxx');
-	  }
-	  catch (SoapFault $expected) {
-
-	    $this->assertEquals("Unable to log in with userid of ".$userid, $expected->faultstring);
-
-	    //	    print_r($response);
-	    return;
-	  }
-
-	  $this->fail('An expected exception has not been raised.');
-	}
-
-        /**
-	 * @depends testVersion
-	 */
-	function testLoginSuccesful()
-	{
-	  $userid = FORGE_ADMIN_USERNAME;
-	  $passwd = FORGE_ADMIN_PASSWORD;
-
-	  $response = $this->login($userid, $passwd);
-
-	  $this->assertNotNull($response);
-	}
-
-
-	// Name: logout
-	// Binding: GForgeAPIBinding
-	// Input:
-	//   use: encoded
-	//   message: logoutRequest
-	//   parts:
-	//     session_ser: xsd:string
-	// Output:
-	//   use: encoded
-	//   message: logoutResponse
-	//   parts:
-	//     logoutResponse: xsd:string
-
-        /**
-	 * @depends testLoginSuccesful
-	 */
-	/*	function testLogout()
-	{
-
-
-
-	  $response = $this->soapclient->logout('coin');
-
-	  print_r('logout response :'. $response);
-
-	}
-	*/
-}
diff --git a/tests/func/Soap/usergroup.php b/tests/func/Soap/usergroup.php
deleted file mode 100644
index c82360f..0000000
--- a/tests/func/Soap/usergroup.php
+++ /dev/null
@@ -1,395 +0,0 @@
-<?php
-/*
- * Copyright (C) 2009 Olivier Berger, Institut TELECOM
- *
- * This file is part of FusionForge.
- *
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * FusionForge is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-require_once 'PHPUnit/Framework/TestCase.php';
-
-class SoapUserGroupProcess extends PHPUnit_Framework_TestCase
-{
-
-	function setUp()
-	{
-	  //	  print_r("setup\n");
-	  $this->session = NULL;
-	  $this->soapclient = NULL;
-
-	  //	  try {
-
-	  // see comments in SoapLoginProcess:setup() for details about this
-	  $ip = gethostbyname(HOST);
-	  if ($ip != HOST)
-	    {
-
-		$this->soapclient = new SoapClient(WSDL_URL,
-						   array('cache_wsdl' => WSDL_CACHE_NONE,
-							 'trace' => true));
-
-		//	  } catch (SoapFault $fault) {
-		//	    $fault->faultstring;
-		//	    print_r($fault);
-		//	  }
-		//	  print_r($this->soapclient);
-	    }
-	}
-
-	function tearDown()
-	{
-	   if ($this->session) {
-	     $response = $this->soapclient->logout($this->session);
-	     //	     print($response);
-	   }
-	 }
-
-
-
-	// performs a login and returns a session "cookie"
-	function login($userid, $passwd)
-	{
-	        $this->assertNotNull($this->soapclient);
-		$response = $this->soapclient->login($userid, $passwd);
-
-		if ($response) {
-
-			$this->session = $response;
-
-			//	    print_r($this->session);
-		}
-
-		return $response;
-	}
-
-	function testLoginSuccesful()
-	{
-		$userid = FORGE_ADMIN_USERNAME;
-		$passwd = FORGE_ADMIN_PASSWORD;
-
-		$response = $this->login($userid, $passwd);
-
-		$this->assertNotNull($response);
-
-	}
-
-
-	// Name: getGroups
-	// Binding: GForgeAPIBinding
-	// Style: rpc
-	// Input:
-	//   use: encoded
-	//   message: getGroupsRequest
-	//   parts:
-	//     session_ser: xsd:string
-	//     group_ids: tns:ArrayOfint
-	// Output:
-	//   use: encoded
-	//   message: getGroupsResponse
-	//   parts:
-	//     return: tns:ArrayOfGroup
-
-	// Name: getGroupsByName
-	// Binding: GForgeAPIBinding
-	// Input:
-	//   use: encoded
-	//   message: getGroupsByNameRequest
-	//   parts:
-	//     session_ser: xsd:string
-	//     group_names: tns:ArrayOfstring
-	// Output:
-	//   use: encoded
-	//   message: getGroupsByNameResponse
-	//   parts:
-	//     return: tns:ArrayOfGroup
-
-	/**
-	 * @depends testLoginSuccesful
-	 */
-	function testGetGroupsByNameEmpty()
-	{
-
-		$this->login(FORGE_ADMIN_USERNAME, FORGE_ADMIN_PASSWORD);
-
-		$this->assertNotNull($this->session);
-
-		try {
-			$response = $this->soapclient->getGroupsByName($this->session);
-		}
-		catch (SoapFault $expected) {
-			//	    print_r($expected->faultstring);
-
-			// Use strpos instead of assertStringStartsWith (for PHPunit 3.3 compatibility)
-			$this->assertTrue( strpos($expected->faultstring, 'Could Not Get Groups by Name') === 0);
-			//$this->assertStringStartsWith('Could Not Get Groups by Name', $expected->faultstring);
-
-			return;
-		}
-
-		$this->fail('An expected exception has not been raised. Got response :'.$response);
-	}
-
-	/**
-	 * @depends testLoginSuccesful
-	 */
-	function testGetGroupsByName()
-	{
-		$this->login(FORGE_ADMIN_USERNAME, FORGE_ADMIN_PASSWORD);
-
-		$this->assertNotNull($this->session);
-
-		$groups = array('template' => 'template',
-			  'stats' => 'stats',
-			  'peerrating' => 'peerrating',
-			  'siteadmin' => 'siteadmin',
-			  'newsadmin' => 'newsadmin'
-			  );
-
-			  // individual retrieval for each of the default groups
-			  foreach (array_keys($groups) as $group_name) {
-			  	$response = $this->soapclient->getGroupsByName($this->session,array($group_name));
-
-			  	$group = $response[0];
-			  	//	    print_r($group);
-			  	$this->assertEquals($group_name, $group->unix_group_name);
-			  }
-
-			  // retrieval of a list of groups
-			  $response = $this->soapclient->getGroupsByName($this->session, array_keys($groups));
-			  foreach ($response as $group) {
-			  	//	    print_r($group);
-			  	$this->assertEquals($groups[$group->unix_group_name], $group->unix_group_name);
-
-			  	$group_id = $group->group_id;
-
-			  	// now verify that getGroups() returns the same
-			  	$response = $this->soapclient->getGroups($this->session, array($group_id));
-			  	$group2 = $response[0];
-			  	//	    print_r($group);
-			  	$this->assertEquals($group_id, $group2->group_id);
-			  	$this->assertEquals($group->unix_group_name, $group2->unix_group_name);
-			  }
-
-	}
-
-
-	// Name: getPublicProjectNames
-	// Binding: GForgeAPIBinding
-	// Input:
-	//   use: encoded
-	//   message: getPublicProjectNamesRequest
-	//   parts:
-	//     session_ser: xsd:string
-	// Output:
-	//   use: encoded
-	//   message: getPublicProjectNamesResponse
-	//   parts:
-	//     return: tns:ArrayOfstring
-
-
-	// /**
-	//  * @depends testLoginSuccesful
-	//  */
-	// function testGetPublicProjectNamesNotLoggedIn()
-	// {
-
-	// 	//	  print_r($this->loggedIn);
-	// 	$this->assertNotNull($this->loggedIn);
-
-	// 	$response = $this->soapclient->getPublicProjectNames();
-
-	// 		  print_r($response);
-	// 	$this->assertContains("newsadmin", $response);
-	// 	$this->assertContains("siteadmin", $response);
-
-	// }
-
-	/**
-	 * @depends testLoginSuccesful
-	 */
-	// function testGetPublicProjectNamesLoggedIn()
-	// {
-
-	// 	$this->login(FORGE_ADMIN_USERNAME, FORGE_ADMIN_PASSWORD);
-	// 	$this->assertNotNull($this->loggedIn);
-	// 	$this->assertNotNull($this->session);
-
-	// 	//	  print_r($this->loggedIn);
-	// 	$this->assertNotNull($this->loggedIn);
-
-	// 	$response = $this->soapclient->getPublicProjectNames($this->session);
-	// 	$this->assertContains("newsadmin", $response);
-	// 	$this->assertContains("siteadmin", $response);
-
-	// 	//print_r($response);
-	// }
-
-	// Name: getUsers
-	// Binding: GForgeAPIBinding
-	// Style: rpc
-	// Input:
-	//   use: encoded
-	//   message: getUsersRequest
-	//   parts:
-	//     session_ser: string
-	//     user_ids: tns:ArrayOfint
-	// Output:
-	//   use: encoded
-	//   message: getUsersResponse
-	//   parts:
-	//     userResponse: tns:ArrayOfUser
-
-
-	// Name: getUsersByName
-	// Binding: GForgeAPIBinding
-	// Input:
-	//   use: encoded
-	//   message: getUsersByNameRequest
-	//   parts:
-	//     session_ser: string
-	//     user_ids: tns:ArrayOfstring
-	// Output:
-	//   use: encoded
-	//   message: getUsersByNameResponse
-	//   parts:
-	//     userResponse: tns:ArrayOfUser
-
-	// Name: userGetGroups
-	// Binding: GForgeAPIBinding
-	// Style: rpc
-	// Input:
-	//   use: encoded
-	//   message: userGetGroupsRequest
-	//   parts:
-	//     session_ser: string
-	//     user_id: xsd:int
-	// Output:
-	//   use: encoded
-	//   message: userGetGroupsResponse
-	//   parts:
-	//     groupResponse: tns:ArrayOfGroup
-
-
-	/**
-	 * @depends testLoginSuccesful
-	 */
-	function testGetUsersByNameEmpty()
-	{
-		$this->login(FORGE_ADMIN_USERNAME, FORGE_ADMIN_PASSWORD);
-
-		$this->assertNotNull($this->session);
-
-		try {
-			$response = $this->soapclient->getUsersByName($this->session);
-		}
-		catch (SoapFault $expected) {
-			//	    print_r($expected->faultstring);
-
-			// Use strpos instead of assertStringStartsWith (for PHPunit 3.3 compatibility)
-			$this->assertTrue( strpos($expected->faultstring, 'Could Not Get Users By Name') === 0);
-			//	  	$this->assertStringStartsWith('Could Not Get Users By Name', $expected->faultstring);
-
-			return;
-		}
-
-		$this->fail('An expected exception has not been raised. Got response :'.$response);
-	}
-
-        /**
-	 * @depends testLoginSuccesful
-	 */
-	function testGetUsersByNameBug63()
-	{
-	  $this->login(FORGE_ADMIN_USERNAME, FORGE_ADMIN_PASSWORD);
-
-	  $this->assertNotNull($this->session);
-
-	  // corner case, but a dangerous ? one : the way the SOAP
-	  // server works allow to trick it in returning several
-	  // values at a time : this one may be fixed some day and we'd then
-	  $users = array('admin", "None' => array( 'count' => 2,
-						   'user_names' => array(FORGE_ADMIN_USERNAME, 'None')));
-
-	  foreach (array_keys($users) as $user_name) {
-	    $response = $this->soapclient->getUsersByName($this->session,array($user_name));
-
-	    $this->assertEquals($users[$user_name]['count'], count($response));
-
-	    foreach ($response as $user) {
-	      //	      print_r($user);
-	      $this->assertContains($user->user_name, $users[$user_name]['user_names']);
-	    }
-	  }
-	}
-
-	/**
-	 * @depends testLoginSuccesful
-	 */
-	function testGetUsersByName()
-	{
-		$this->login(FORGE_ADMIN_USERNAME, FORGE_ADMIN_PASSWORD);
-
-		$this->assertNotNull($this->session);
-
-		$users = array('None'=>'None',
-			       FORGE_ADMIN_USERNAME => FORGE_ADMIN_USERNAME);
-
-		foreach (array_keys($users) as $user_name) {
-			//	    print_r($user_name);
-			$response = $this->soapclient->getUsersByName($this->session,array($user_name));
-
-			$user = $response[0];
-			// print_r($user);
-			$this->assertEquals($user_name, $user->user_name);
-		}
-
-		$response = $this->soapclient->getUsersByName($this->session, array_keys($users));
-		foreach ($response as $user) {
-			// print_r($user);
-			$this->assertEquals($users[$user->user_name], $user->user_name);
-
-			$user_id = $user->user_id;
-
-			// now verify that getUsers() returns the same
-			$response = $this->soapclient->getUsers($this->session, array($user_id));
-			$user2 = $response[0];
-			// print_r($user2);
-			$this->assertEquals($user_id, $user2->user_id);
-			$this->assertEquals($user->user_name, $user2->user_name);
-
-			//	    print_r($user->user_name);
-			$response = $this->soapclient->userGetGroups($this->session, $user_id);
-
-			if ($user->user_name == 'None') {
-				$this->assertEquals(0,count($response));
-			}
-
-			if ($user->user_name == FORGE_ADMIN_USERNAME) {
-
-				$adminGroups = array('template','stats','peerrating','siteadmin','newsadmin');
-
-				foreach ($response as $group) {
-					//		print_r($group->unix_group_name);
-
-					$this->assertContains($group->unix_group_name, $adminGroups);
-				}
-
-			}
-
-		}
-
-	}
-}

commit d8117d0f63b3a13437aceec51b2f2d4d6c59bda2
Author: Roland Mas <lolando at debian.org>
Date:   Wed Dec 3 17:51:49 2014 +0100

    SOAP testsuite: simple checks for trackers

diff --git a/tests/func/Soap/soapTest.php b/tests/func/Soap/soapTest.php
index 2b5f9b3..d2a0196 100644
--- a/tests/func/Soap/soapTest.php
+++ b/tests/func/Soap/soapTest.php
@@ -38,7 +38,7 @@ class SoapTest extends FForge_SeleniumTestCase
         
 	function testSoap()
 	{
-		$this->populateStandardTemplate('empty');
+		$this->populateStandardTemplate('trackers');
 		$this->init();
 
         $userid = FORGE_ADMIN_USERNAME;
@@ -84,6 +84,7 @@ class SoapTest extends FForge_SeleniumTestCase
         $response = $this->soapclient->getGroupsByName($this->session,array('projecta'));
         $group = $response[0];
         $this->assertEquals('projecta', $group->unix_group_name);
+        $projecta = $group;
         
         // Get several groups
         $response = $this->soapclient->getGroupsByName($this->session,array('tmpl', 'projecta'));
@@ -93,6 +94,30 @@ class SoapTest extends FForge_SeleniumTestCase
             $this->assertEquals($group->group_id, $group2->group_id);
             $this->assertEquals($group->unix_group_name, $group2->unix_group_name);
         }
+
+        // Check trackers
+        $trackers = $this->soapclient->getArtifactTypes($this->session, $projecta->group_id);
+        $found = false;
+        foreach ($trackers as $t) {
+            if ($t->name == 'Bugs') {
+                $found = true;
+                $tracker = $t;
+            }
+        }
+        $this->assertTrue($found, "Trackers 'Bugs' not found");
+
+        $response = $this->soapclient->addArtifact($this->session, $projecta->group_id, $tracker->group_artifact_id, 1, 3, 100, "Bug submitted by SOAP", "Bug details are not really relevant here", array());
+
+		$this->clickAndWait("link=Tracker");
+		$this->clickAndWait("link=Bugs");
+		$this->assertTrue($this->isTextPresent("Bug submitted by SOAP"));
+		$this->clickAndWait("link=Bug submitted by SOAP");
+        $this->type("summary", 'Bug summary edited via web interface');
+		$this->clickAndWait("submit");
+
+        $bugs = $this->soapclient->getArtifacts($this->session, $projecta->group_id, $tracker->group_artifact_id, 0, 0);
+        $bug = $bugs[0];
+        $this->assertEquals('Bug summary edited via web interface', $bug->summary);
 	}
 }
 ?>

commit 55b47f0823b9244027b73f60920109d60e1a7a98
Author: Roland Mas <lolando at debian.org>
Date:   Wed Dec 3 17:11:06 2014 +0100

    Started modernizing SOAP testsuite in order to make it more complete

diff --git a/tests/func/Soap/soapTest.php b/tests/func/Soap/soapTest.php
new file mode 100644
index 0000000..2b5f9b3
--- /dev/null
+++ b/tests/func/Soap/soapTest.php
@@ -0,0 +1,98 @@
+<?php
+/*
+ * Copyright (C) 2014 Roland Mas
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *      
+ * FusionForge is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */             
+
+require_once dirname(dirname(__FILE__)).'/Testing/SeleniumForge.php';
+
+class SoapTest extends FForge_SeleniumTestCase
+{
+    function setUp() {
+        parent::setUp();
+
+        $this->session = NULL;
+        $this->soapclient = NULL;
+        
+        $this->soapclient = new SoapClient(WSDL_URL,
+        array('cache_wsdl' => WSDL_CACHE_NONE,       
+        'trace' => true));
+        
+        $this->assertNotNull($this->soapclient);
+    }        
+        
+	function testSoap()
+	{
+		$this->populateStandardTemplate('empty');
+		$this->init();
+
+        $userid = FORGE_ADMIN_USERNAME;
+        $passwd = FORGE_ADMIN_PASSWORD;
+
+        // Check version number
+        $version = $this->soapclient->version();
+        $this->assertRegexp('/^[-0-9.+]*$/', $version);
+
+        // Check login
+        $response = $this->soapclient->login($userid, $passwd);
+        $this->assertNotNull($response);
+        $this->session = $response;
+
+        // Check logging in with nonexisting user
+        try {
+            $response = $this->soapclient->login('coin', 'pan');
+            $this->fail('An expected exception has not been raised.');
+        }
+        catch (SoapFault $expected) {
+            $this->assertEquals("Unable to log in with userid of coin", $expected->faultstring);
+        }
+        
+        // Check logging in with wrong password
+        try {
+            $response = $this->soapclient->login(FORGE_ADMIN_USERNAME, 'pan');
+            $this->fail('An expected exception has not been raised.');
+        }
+        catch (SoapFault $expected) {
+            $this->assertEquals("Unable to log in with userid of ".FORGE_ADMIN_USERNAME, $expected->faultstring);
+        }
+
+        // Get list of groups with empty parameters
+		try {
+			$response = $this->soapclient->getGroupsByName($this->session);
+            $this->fail('An expected exception has not been raised. Got response :'.$response);
+		}
+		catch (SoapFault $expected) {
+			$this->assertTrue( strpos($expected->faultstring, 'Could Not Get Projects by Name') === 0);
+		}
+
+        // Get one group
+        $response = $this->soapclient->getGroupsByName($this->session,array('projecta'));
+        $group = $response[0];
+        $this->assertEquals('projecta', $group->unix_group_name);
+        
+        // Get several groups
+        $response = $this->soapclient->getGroupsByName($this->session,array('tmpl', 'projecta'));
+        foreach ($response as $group) {
+            $response2 = $this->soapclient->getGroups($this->session, array($group->group_id));
+            $group2 = $response2[0];
+            $this->assertEquals($group->group_id, $group2->group_id);
+            $this->assertEquals($group->unix_group_name, $group2->unix_group_name);
+        }
+	}
+}
+?>

-----------------------------------------------------------------------

Summary of changes:
 src/www/soap/index.php          |    4 +-
 tests/func/70_SOAP/soapTest.php |  123 ++++++++++++
 tests/func/Soap/AllTests.php    |   81 --------
 tests/func/Soap/checks.php      |   54 ------
 tests/func/Soap/login.php       |  216 ---------------------
 tests/func/Soap/usergroup.php   |  395 ---------------------------------------
 6 files changed, 125 insertions(+), 748 deletions(-)
 create mode 100644 tests/func/70_SOAP/soapTest.php
 delete mode 100644 tests/func/Soap/AllTests.php
 delete mode 100644 tests/func/Soap/checks.php
 delete mode 100644 tests/func/Soap/login.php
 delete mode 100644 tests/func/Soap/usergroup.php


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list