Skip to content
Snippets Groups Projects
cloud.test 2.71 KiB
Newer Older
<?php

/**
 * @file
 * This is the base class of all Cloud module family.
 * Basically this test case does nothing. 
 *
 * Copyright (c) 2010-2012 DOCOMO Innovations, Inc.
 *
 */

/**
 * This class is the base class for some of the 
 * Simple Tests.  This class has been simplified
 * for unit tests that do not require loading of
 * sub-clouds.  For any tests that require sub-clouds,
 * implement AwsCloudTestCase instead of this class.
 */
class CloudTestCase extends DrupalWebTestCase {

  protected $privileged_user;

  public static function getInfo() {
    return array(
      'name'        => 'Cloud'           ,
      'description' => 'Cloud Test Cases',
      'group'       => 'Cloud'           ,
    );
  }

  public function setUp() {
    //setup takes arguments so
    //extended sub-classes can pass modules 
    //and have them get loaded.
    $args = func_get_args();
    $modules = array_merge(array(
      'cloud'                 ,
      'cloud_server_templates',
      'cloud_scripting'       ,
      'cloud_pricing'         ,
      'cloud_alerts'          ,
      'cloud_activity_audit'  ,
      'cloud_cluster'         ,
      'aws_ec2_api'           ,   //Found bug where scripting is making references to AWS modules.  Shouldn't be the case
      'aws_ec2_lib'           ,
      'aws'
      ), 
    $args);
    
    call_user_func_array(array('parent', 'setUp'), $modules);
    
    // Create and log in our privileged user.
    $this->privileged_user = $this->drupalCreateUser(array(
    
      // system module
      'access administration pages'       ,
      'administer site configuration'     ,

      // Cloud module
      'administer cloud'                  ,
      'access dashboard'                  ,

       // Activity Audit module
      'access audit report'    ,
      

      // Server Template module
      'copy server template'   ,
      'create server template' ,
      'delete server template' ,
      'edit server template'   ,
      'launch server template' ,
      'list server templates'  ,
      'set scripts and alerts' ,
      'view server template'   ,
      
      // Alerts module
      'list alerts'   ,
      'create alert'  ,
      'view alerts'   ,
      'edit alert'    ,
      'delete alert'  ,
      
      // Cluster
      'create cluster',
      'delete cluster',
      'list clusters' ,
      'update cluster',
      
      // Scripting module
      'create script' , 
      'list scripts'  , 
      'edit script'   , 
      'delete script' ,
      
      // Pricing module
      'create pricing', 
      'list pricing'  ,  
      'edit pricing'  , 
      'delete pricing',
    ));

    $this->drupalLogin($this->privileged_user);

  }
   
  public function tearDown() {
     parent::tearDown();    
  }    

}