Skip to content

Commit

Permalink
Merge pull request #39 from grycap/tests
Browse files Browse the repository at this point in the history
Add Unit tests
  • Loading branch information
micafer authored Nov 15, 2017
2 parents 5ad3234 + eef68a3 commit 118dfe6
Show file tree
Hide file tree
Showing 51 changed files with 2,595 additions and 635 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fully functional infrastructure.

IM web interface is based on PHP, so a web server with PHP support must be installed.

Also the mcrypt PHP module must be installed and enabled.
Also the mcrypt PHP modules must be installed and enabled.

It is also required to install the PHP module to access SQLite databases.

Expand Down
2 changes: 1 addition & 1 deletion create_tar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ then
fi

rm -f dist/IM-web-${VERSION}.tar.gz
tar --exclude=create_tar.sh --exclude=docker --exclude=doc --exclude=dist --exclude=.git -czf dist/IM-web-${VERSION}.tar.gz *
tar --exclude=create_tar.sh --exclude=docker --exclude=doc --exclude=dist --exclude=.git --exclude=test -czf dist/IM-web-${VERSION}.tar.gz *
2 changes: 1 addition & 1 deletion credentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

if(!isset($_SESSION)) session_start();

include('user.php');
include_once('user.php');
if (!check_session_user()) {
header('Location: index.php?error=Invalid User');
} else {
Expand Down
4 changes: 2 additions & 2 deletions credform.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
if(!isset($_SESSION)) session_start();

include('config.php');
include('user.php');
include('cred.php');
include_once('user.php');
include_once('cred.php');
if (!check_session_user()) {
header('Location: index.php?error=Invalid User');
} else {
Expand Down
2 changes: 1 addition & 1 deletion credinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

if(!isset($_SESSION)) session_start();

include('user.php');
include_once('user.php');
if (!check_session_user()) {
header('Location: index.php?error=Invalid User');
} else {
Expand Down
2 changes: 1 addition & 1 deletion db.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class IMDB extends SQLite3
{
function __construct()
{
include('config.php');
include('config.php');
$this->open($im_db);
}

Expand Down
6 changes: 3 additions & 3 deletions form.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

if(!isset($_SESSION)) session_start();

include('user.php');
include_once('user.php');
if (!check_session_user()) {
header('Location: index.php?error=Invalid User');
} else {
Expand Down Expand Up @@ -50,7 +50,7 @@
</head>
<body>

<?php include('radl.php')?>
<?php include_once('radl.php')?>


<div id="caja_total_blanca">
Expand Down Expand Up @@ -105,7 +105,7 @@
<tbody>
<tr>
<td>
<textarea type="ADDR" align="bottom" name="radl"><?php echo $radl_data;?></textarea>
<textarea type="ADDR" align="bottom" name="radl"></textarea>
</td>
</tr>
<tr>
Expand Down
10 changes: 5 additions & 5 deletions format.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function formatState($state) {
if ($state == "failed") $res = "<span style='color:red'>failed</span>";
if ($state == "unknown") $res = "<span style='color:orange'>unknown</span>";
if ($state == "running") $res = "<span style='color:green'>configuring</span>";
if ($state == "configured") $res = "<span style='color:green'>" . $state . "</span>";
if ($state == "configured") $res = "<span style='color:green'>configured</span>";

return $res;
}
Expand Down Expand Up @@ -154,13 +154,13 @@ function getOutPorts($radl) {
else if ($key == 'outports')
$ports = $value;
}

if ($public and strlen($ports) > 0) {
$port_parts = explode(",", $ports);
foreach ($port_parts as $port_pair) {
$port_pair_parts = explode("-", $port_pair);
if (count($port_pair_parts)>1 and $port_pair_parts[0] != $port_pair_parts[1]) {
$res[$port_pair_parts[0]] = $port_pair_parts[1];
$port_pair_parts = explode("-", $port_pair);
if (count($port_pair_parts)>1) {
$res[$port_pair_parts[0]] = $port_pair_parts[1];
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions getcontmsg.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@

if(!isset($_SESSION)) session_start();

include('user.php');
include_once('user.php');
if (!check_session_user()) {
header('Location: index.php?error=Invalid User');
} else {
if (isset($_GET['id'])) {
include('im.php');
include_once('im.php');
include('config.php');
$id = $_GET['id'];
if (isset($_GET['vmid'])) {
$vmid = $_GET['vmid'];
$cont_msg = GetVMContMsg($im_host,$im_port,$im_method,$id,$vmid);
$cont_msg = GetIM()->GetVMContMsg($id,$vmid);
} else {
$cont_msg = GetInfrastructureContMsg($im_host,$im_port,$im_method,$id);
$cont_msg = GetIM()->GetInfrastructureContMsg($id);
}
}

Expand All @@ -53,7 +53,7 @@
</head>
<body>

<?php include('radl.php')?>
<?php include_once('radl.php')?>



Expand Down
8 changes: 4 additions & 4 deletions getoutputs.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

if(!isset($_SESSION)) session_start();

include('user.php');
include_once('user.php');
if (!check_session_user()) {
header('Location: index.php?error=Invalid User');
} else {
if (isset($_GET['id'])) {
include('im.php');
include_once('im.php');
include('config.php');
$id = $_GET['id'];
$outputs = GetOutputs($im_host,$im_port,$id);
$outputs = GetIM()->GetOutputs($id);
}

?>
Expand All @@ -48,7 +48,7 @@
</head>
<body>

<?php include('radl.php')?>
<?php include_once('radl.php')?>



Expand Down
4 changes: 2 additions & 2 deletions getvminfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@

include_once('im.php');
include_once('config.php');
$res = GetVMInfo($im_host,$im_port,$im_method, $id, $vmid);
$res = GetIM()->GetVMInfo($id, $vmid);

if (is_string($res) && strpos($res, "Error") !== false) {
header('Location: error.php?msg=' . urlencode($res));
} else {
$radl_tokens = parseRADL($res);
$radl_tokens = parseRADL($res);
$outports = getOutPorts($res);
?>
<!DOCTYPE HTML>
Expand Down
4 changes: 2 additions & 2 deletions group_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

if(!isset($_SESSION)) session_start();

include('user.php');
include_once('user.php');
if (!check_session_user() || !check_admin_user()) {
header('Location: index.php?error=Invalid User');
} else {
include('group.php');
include_once('group.php');
$groups = get_groups();

?>
Expand Down
4 changes: 2 additions & 2 deletions groupform.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

if(!isset($_SESSION)) session_start();

include('user.php');
include_once('user.php');
if (!check_session_user() || !check_admin_user()) {
header('Location: index.php?error=Invalid User');
} else {
Expand All @@ -41,7 +41,7 @@
<link rel="stylesheet" href="css/style_menutab.css">
</head>
<body>
<?php include('group.php')?>
<?php include_once('group.php')?>


<div id="caja_total_blanca">
Expand Down
Loading

0 comments on commit 118dfe6

Please sign in to comment.