FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
UploadUrlTest.php
1 <?php
2 /***********************************************************
3  Copyright (C) 2008 Hewlett-Packard Development Company, L.P.
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  version 2 as published by the Free Software Foundation.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  ***********************************************************/
28 /*
29  * Yuk! This test is ugly! NOTE: Will need to set a proxy for this to
30  * work inside hp.
31  */
32 
33 require_once ('../../../tests/fossologyTestCase.php');
34 require_once ('../../../tests/TestEnvironment.php');
35 
36 global $URL;
37 
39 {
40 
41  function testUploadUrl()
42  {
43  global $URL;
44 
45  print "starting UploadUrlTest\n";
46  //$this->useProxy('http://web-proxy.fc.hp.com:8088', 'web-proxy', '');
47  $this->Login();
48 
49  $loggedIn = $this->mybrowser->get($URL);
50  $this->assertTrue($this->myassertText($loggedIn, '/Upload/'));
51  $this->assertTrue($this->myassertText($loggedIn, '/From URL/'));
52  $page = $this->mybrowser->get("$URL?mod=upload_url");
53  $this->assertTrue($this->myassertText($page, '/Upload from URL/'));
54  $this->assertTrue($this->myassertText($page, '/Enter the URL to the file/'));
55 
56  /* select Testing folder, filename based on pid or session number */
57 
58  $FolderId = $this->getFolderId('Basic-Testing', $page, 'folder');
59  $this->assertTrue($this->mybrowser->setField('folder', $FolderId));
60  $simpletest = 'http://downloads.sourceforge.net/simpletest/simpletest_1.0.1.tar.gz';
61  $this->assertTrue($this->mybrowser->setField('geturl', $simpletest));
62  $desc = 'File uploaded by test UploadUrlTest';
63  $this->assertTrue($this->mybrowser->setField('description', "$desc"));
64  $pid = getmypid();
65  $upload_name = 'TestUploadUrl-' . "$pid";
66  $this->assertTrue($this->mybrowser->setField('name', $upload_name));
67  /* we won't select any agents this time' */
68  $page = $this->mybrowser->clickSubmit('Upload!');
69  $this->assertTrue($page);
70  //print "************ page after Upload! *************\n$page\n";
71  $this->assertTrue($this->myassertText($page, '/has been scheduled. It is/'));
72 
73 
74  }
75 }
76 ?>
getFolderId($folderName, $page, $selectName)
Login($User=NULL, $Password=NULL)