FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
UploadSrvArchiveTest.php
1 <?php
2 
3 
4 /***********************************************************
5  Copyright (C) 2008 Hewlett-Packard Development Company, L.P.
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License
9  version 2 as published by the Free Software Foundation.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License along
17  with this program; if not, write to the Free Software Foundation, Inc.,
18  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  ***********************************************************/
20 
32 /*
33  * NOTE this test is difficult in that the material uploaded MUST be
34  * available to the test. If multiple agent systems are used, then the
35  * material must be available there as well.
36  *
37  * One possibility is to modify the readme to include the creation of
38  * a test user and material. Since it takes sudo, the test cannot
39  * automatically do it. Well it could, but it's a bad idea.
40  */
41 
42 require_once ('../../../tests/fossologyTestCase.php');
43 require_once ('../../../tests/TestEnvironment.php');
44 
45 global $URL;
46 
48  function setUp() {
49  /* check to see if the user and material exist*/
50  $this->assertTrue(file_exists('/home/fosstester/.bashrc'),
51  "FAILURE! .bashrc not found\n");
52  $this->Login();
53  }
54 
55  function testUploadUSrv() {
56 
57  global $URL;
58 
59  print "starting UploadUSrvTest\n";
60  $loggedIn = $this->mybrowser->get($URL);
61  $this->assertTrue($this->myassertText($loggedIn, '/Upload/'),
62  'Did not find Upload Menu');
63  $this->assertTrue($this->myassertText($loggedIn, '/From Server/'),
64  'Did not find From Server Menu');
65  $page = $this->mybrowser->get("$URL?mod=upload_srv_files");
66  $this->assertTrue($this->myassertText($page, '/Upload from Server/'),
67  'Did not find Upload from Server Title');
68  $this->assertTrue($this->myassertText($page, '/on the server to upload:/'),
69  'Did not find the sourcefile Selection Text');
70  /* select Testing folder */
71  $FolderId = $this->getFolderId('Basic-Testing', $page, 'folder');
72  $this->assertTrue($this->mybrowser->setField('folder', $FolderId));
73  $this->assertTrue($this->mybrowser->setField('sourcefiles', '/home/fosstester/archives/simpletest_1.0.1.tar.gz'));
74  $desc = 'File uploaded by test UploadSrvTest to folder Testing';
75  $this->assertTrue($this->mybrowser->setField('description', "$desc"));
76  /* we won't select any agents this time' */
77  $page = $this->mybrowser->clickSubmit('Upload!');
78  $this->assertTrue($page);
79  $this->assertTrue($this->myassertText($page,
80  '/The upload for \/home\/fosstester\/archives\/simpletest_1\.0\.1\.tar\.gz/'),
81  "FAIL! Did not match Upload message\n");
82  //print "************ page after Upload! *************\n$page\n";
83  }
84 }
85 ?>
getFolderId($folderName, $page, $selectName)
Login($User=NULL, $Password=NULL)