<?php
// $Id: flickrrippr.test,v 1.2 2010/07/28 00:10:58 taniwha Exp $

/**
 * @file
 * Unit Tests for flickrrippr module
 * http://drupal.org/node/265762
 */

class FlickrRipprTestCase extends DrupalWebTestCase {

  /**
   * User with rights to post SimpleTest Example content.
   */
  protected $privileged_user;

  /**
   * getInfo() returns properties that are displayed in the test selection form.
   */
  public static function getInfo() {
    return array(
      'name' => 'Flickr Rippr',
      'description' => 'Ensure that the flickrrippr content type provided functions properly.',
      'group' => 'Flickr Rippr',
    );
  }

  /**
   * setUp() performs any pre-requisite tasks that need to happen. 
   */
  public function setUp() {
    // Enable any modules required for the test.
    parent::setUp('flickrrippr');

    // Create and log in our privileged user.
    $this->privileged_user = $this->drupalCreateUser( array('Configure own blogged flickr stream'));
    $this->drupalLogin($this->privileged_user);
  }

  /**
   * Test saving your settings
   */
  public function testSavingsettings() {
  
    $this->drupalGet('user/flickrippr');
    $this->assertResponse(200);
    $edit['flickr_username'] = 'br3nda';
    $this->drupalPost('user/flickrippr', $edit, 'Save');
    $this->assertResponse(200);
    $this->drupalGet('user/flickrippr');
    $this->assertField('flickr_username', 'br3nda');

    $edit['flickr_username'] = 'cycada';
    $this->drupalPost('user/flickrippr', $edit, 'Save');
    $this->drupalGet('user/flickrippr');
    $this->assertField('flickr_username', 'cycada');
  }

  function testFetchingPhotos() {
    $edit['flickr_username'] = 'br3nda';
    $this->drupalPost('user/flickrippr', $edit, 'Save');
    $this->drupalGet('admin/content/flickrrippr');
    $this->assertResponse(500);

  }


}

class FlickrRipprAdminTestCase extends DrupalWebTestCase {

  protected $privileged_user;

  /**
   * getInfo() returns properties that are displayed in the test selection form.
   */
  public static function getInfo() {
    return array(
      'name' => 'Flickr Rippr admin',
      'description' => 'Flickr Rippr Admin stuff',
      'group' => 'Flickr Rippr',
    );
  }

  /**
   * setUp() performs any pre-requisite tasks that need to happen. 
   */
  public function setUp() {
    // Enable any modules required for the test.
    parent::setUp('flickrrippr');

    // Create and log in our privileged user.

  }

//   function testSettingAPIKey() {
//     $this->privileged_user = $this->drupalCreateUser( array('Administer global flickr api settings'));
//     $this->drupalLogin($this->privileged_user);
//     $this->drupalGet('admin');
//     $this->clickLink('Flickr API Settings');
//     $this->assertResponse(500);
//   }
  function testFetchingPhotos() {
  }
}