diff options
author | mamouneyya <mamoun.diraneyya@gmail.com> | 2010-12-09 18:31:01 +0200 |
---|---|---|
committer | mamouneyya <mamoun.diraneyya@gmail.com> | 2010-12-09 18:31:01 +0200 |
commit | 3e2610ea83c60805d5e727df6509da6c49fd6c7b (patch) | |
tree | 28638f7a1cd2e298587f4b3960caf409f7d2d2fa /modules/gallery/tests | |
parent | 6aabab4b715ff8ac00cc667e9d0a40c9868410d8 (diff) | |
parent | c3ef8921260db8e39b6d2a7b4708e3d19f35f8b5 (diff) |
Merge remote branch 'gallery3/master'
Diffstat (limited to 'modules/gallery/tests')
-rw-r--r-- | modules/gallery/tests/Item_Model_Test.php | 23 | ||||
-rw-r--r-- | modules/gallery/tests/Var_Test.php | 38 | ||||
-rw-r--r-- | modules/gallery/tests/controller_auth_data.txt | 1 | ||||
-rw-r--r-- | modules/gallery/tests/selenium/Add_Album.html | 52 | ||||
-rw-r--r-- | modules/gallery/tests/selenium/Add_Comment.html | 52 | ||||
-rw-r--r-- | modules/gallery/tests/selenium/Add_Item.html | 62 | ||||
-rw-r--r-- | modules/gallery/tests/selenium/Login.html | 47 | ||||
-rw-r--r-- | modules/gallery/tests/xss_data.txt | 52 |
8 files changed, 71 insertions, 256 deletions
diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php index 90c54e3c..264a2128 100644 --- a/modules/gallery/tests/Item_Model_Test.php +++ b/modules/gallery/tests/Item_Model_Test.php @@ -406,6 +406,29 @@ class Item_Model_Test extends Gallery_Unit_Test_Case { return; // pass } $this->assert_true(false, "Shouldn't get here"); + } + + public function urls_test() { + $photo = test::random_photo(); + $this->assert_true( + preg_match("|http://./var/resizes/name_\d+\.jpg\?m=\d+|", $photo->resize_url()), + $photo->resize_url() . " is malformed"); + $this->assert_true( + preg_match("|http://./var/thumbs/name_\d+\.jpg\?m=\d+|", $photo->thumb_url()), + $photo->thumb_url() . " is malformed"); + $this->assert_true( + preg_match("|http://./var/albums/name_\d+\.jpg\?m=\d+|", $photo->file_url()), + $photo->file_url() . " is malformed"); + // Albums have special thumbnails. Empty album has cachebuster of 0 since it has no thumbnail + $album = test::random_album(); + $this->assert_true( + preg_match("|http://./var/thumbs/name_\d+/\.album\.jpg\?m=0|", $album->thumb_url()), + $album->thumb_url() . " is malformed"); + + $photo = test::random_photo($album); + $this->assert_true( + preg_match("|http://./var/thumbs/name_\d+/\.album\.jpg\?m=\d+|", $album->thumb_url()), + $album->thumb_url() . " is malformed"); } } diff --git a/modules/gallery/tests/Var_Test.php b/modules/gallery/tests/Var_Test.php index b3492c71..292fe2f1 100644 --- a/modules/gallery/tests/Var_Test.php +++ b/modules/gallery/tests/Var_Test.php @@ -19,31 +19,37 @@ */ class Var_Test extends Gallery_Unit_Test_Case { public function add_parameter_test() { - module::set_var("gallery", "Parameter", "original value"); - $this->assert_equal("original value", module::get_var("gallery", "Parameter")); + module::set_var("Var_Test", "Parameter", "original value"); + $this->assert_equal("original value", module::get_var("Var_Test", "Parameter")); - module::set_var("gallery", "Parameter", "updated value"); - $this->assert_equal("updated value", module::get_var("gallery", "Parameter")); + module::set_var("Var_Test", "Parameter", "updated value"); + $this->assert_equal("updated value", module::get_var("Var_Test", "Parameter")); } public function clear_parameter_test() { - module::set_var("gallery", "Parameter", "original value"); - $this->assert_equal("original value", module::get_var("gallery", "Parameter")); + module::set_var("Var_Test", "Parameter", "original value"); + module::clear_var("Var_Test", "Parameter"); + $this->assert_equal(null, module::get_var("Var_Test", "Parameter")); + } - module::clear_var("gallery", "Parameter"); - $this->assert_equal(null, module::get_var("gallery", "Parameter")); + public function clear_all_module_parameters_test() { + module::set_var("Var_Test", "Parameter1", "original value"); + module::set_var("Var_Test", "Parameter2", "original value"); + module::clear_all_vars("Var_Test"); + $this->assert_equal(null, module::get_var("Var_Test", "Parameter1")); + $this->assert_equal(null, module::get_var("Var_Test", "Parameter2")); } public function incr_parameter_test() { - module::set_var("gallery", "Parameter", "original value"); - module::incr_var("gallery", "Parameter"); - $this->assert_equal("1", module::get_var("gallery", "Parameter")); + module::set_var("Var_Test", "Parameter", "original value"); + module::incr_var("Var_Test", "Parameter"); + $this->assert_equal("1", module::get_var("Var_Test", "Parameter")); - module::set_var("gallery", "Parameter", "2"); - module::incr_var("gallery", "Parameter", "9"); - $this->assert_equal("11", module::get_var("gallery", "Parameter")); + module::set_var("Var_Test", "Parameter", "2"); + module::incr_var("Var_Test", "Parameter", "9"); + $this->assert_equal("11", module::get_var("Var_Test", "Parameter")); - module::incr_var("gallery", "NonExistent", "9"); - $this->assert_equal(null, module::get_var("gallery", "NonExistent")); + module::incr_var("Var_Test", "NonExistent", "9"); + $this->assert_equal(null, module::get_var("Var_Test", "NonExistent")); } }
\ No newline at end of file diff --git a/modules/gallery/tests/controller_auth_data.txt b/modules/gallery/tests/controller_auth_data.txt index 9ea6043a..24170092 100644 --- a/modules/gallery/tests/controller_auth_data.txt +++ b/modules/gallery/tests/controller_auth_data.txt @@ -1,7 +1,6 @@ modules/comment/controllers/admin_manage_comments.php queue DIRTY_CSRF modules/comment/helpers/comment_rss.php feed DIRTY_AUTH modules/digibug/controllers/digibug.php print_proxy DIRTY_CSRF|DIRTY_AUTH -modules/digibug/controllers/digibug.php close_window DIRTY_AUTH modules/g2_import/controllers/g2.php map DIRTY_CSRF modules/gallery/controllers/admin.php __call DIRTY_AUTH modules/gallery/controllers/albums.php index DIRTY_AUTH diff --git a/modules/gallery/tests/selenium/Add_Album.html b/modules/gallery/tests/selenium/Add_Album.html deleted file mode 100644 index ccd4d0b7..00000000 --- a/modules/gallery/tests/selenium/Add_Album.html +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>AddAlbum</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">AddAlbum</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/index.php/albums/1</td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>link=Add album</td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>name</td> - <td>seleniumtest</td> -</tr> -<tr> - <td>type</td> - <td>title</td> - <td>Selenium Test Album</td> -</tr> -<tr> - <td>type</td> - <td>description</td> - <td>Test</td> -</tr> -<tr> - <td>click</td> - <td>//button[@type='button']</td> - <td></td> -</tr> -<tr> - <td>assertTextPresent</td> - <td>Selenium Test Album</td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/modules/gallery/tests/selenium/Add_Comment.html b/modules/gallery/tests/selenium/Add_Comment.html deleted file mode 100644 index 054e7597..00000000 --- a/modules/gallery/tests/selenium/Add_Comment.html +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>Add comment</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">Add comment</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/index.php/albums/1</td> - <td></td> -</tr> -<tr> - <td>clickAndWait</td> - <td>g-photo-id-2</td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>g-author</td> - <td>Test</td> -</tr> -<tr> - <td>type</td> - <td>g-email</td> - <td>test@gmail.com</td> -</tr> -<tr> - <td>type</td> - <td>g-text</td> - <td>This is a selenium test comment.</td> -</tr> -<tr> - <td>click</td> - <td>//button[@type='submit']</td> - <td></td> -</tr> -<tr> - <td>assertTextPresent</td> - <td>This is a selenium test comment.</td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/modules/gallery/tests/selenium/Add_Item.html b/modules/gallery/tests/selenium/Add_Item.html deleted file mode 100644 index 741dff65..00000000 --- a/modules/gallery/tests/selenium/Add_Item.html +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>AddItem</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">AddItem</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/index.php/albums/1</td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>link=Add an item</td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>name</td> - <td>seleniumitem.jpg</td> -</tr> -<tr> - <td>type</td> - <td>title</td> - <td>Selenium Item</td> -</tr> -<tr> - <td>type</td> - <td>description</td> - <td>Test item</td> -</tr> -<tr> - <td>type</td> - <td>file</td> - <td>/Users/ckieffer/Sites/gallery3.0/core/tests/images/DSC_0003.jpg</td> -</tr> -<tr> - <td>click</td> - <td>//button[@type='button']</td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>link=X</td> - <td></td> -</tr> -<tr> - <td>assertTextPresent</td> - <td>Selenium Item</td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/modules/gallery/tests/selenium/Login.html b/modules/gallery/tests/selenium/Login.html deleted file mode 100644 index d2e45c63..00000000 --- a/modules/gallery/tests/selenium/Login.html +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>Login</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">Login</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/index.php/albums/1</td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>g-login-link</td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>g-name</td> - <td>admin</td> -</tr> -<tr> - <td>type</td> - <td>g-password</td> - <td>admin</td> -</tr> -<tr> - <td>clickAndWait</td> - <td>//button[@type='button']</td> - <td></td> -</tr> -<tr> - <td>clickAndWait</td> - <td>g-user-profile-link</td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt index a714b3e5..0345df96 100644 --- a/modules/gallery/tests/xss_data.txt +++ b/modules/gallery/tests/xss_data.txt @@ -43,8 +43,8 @@ modules/digibug/views/digibug_form.html.php 6 DIRTY form:: modules/exif/views/exif_dialog.html.php 14 DIRTY $details[$i]["caption"] modules/exif/views/exif_dialog.html.php 21 DIRTY $details[$i]["caption"] modules/g2_import/views/admin_g2_import.html.php 9 DIRTY $form -modules/gallery/views/admin_advanced_settings.html.php 21 DIRTY_ATTR text::alternate("g-odd","g-even") -modules/gallery/views/admin_advanced_settings.html.php 22 DIRTY $var->module_name +modules/gallery/views/admin_advanced_settings.html.php 20 DIRTY_ATTR text::alternate("g-odd","g-even") +modules/gallery/views/admin_advanced_settings.html.php 21 DIRTY $var->module_name modules/gallery/views/admin_block_log_entries.html.php 4 DIRTY_ATTR log::severity_class($entry->severity) modules/gallery/views/admin_block_log_entries.html.php 8 DIRTY_JS user_profile::url($entry->user->id) modules/gallery/views/admin_block_log_entries.html.php 10 DIRTY gallery::date_time($entry->timestamp) @@ -355,19 +355,19 @@ modules/user/views/admin_users_group.html.php 24 DIRTY_JS $group modules/watermark/views/admin_watermarks.html.php 20 DIRTY_ATTR $width modules/watermark/views/admin_watermarks.html.php 20 DIRTY_ATTR $height modules/watermark/views/admin_watermarks.html.php 20 DIRTY_ATTR $url -themes/admin_wind/views/admin.html.php 22 DIRTY_JS $theme->url() -themes/admin_wind/views/admin.html.php 39 DIRTY $theme->admin_head() -themes/admin_wind/views/admin.html.php 43 DIRTY $theme->admin_page_top() -themes/admin_wind/views/admin.html.php 51 DIRTY $theme->admin_header_top() -themes/admin_wind/views/admin.html.php 52 DIRTY_JS item::root()->url() -themes/admin_wind/views/admin.html.php 55 DIRTY $theme->user_menu() -themes/admin_wind/views/admin.html.php 58 DIRTY $theme->admin_menu() -themes/admin_wind/views/admin.html.php 61 DIRTY $theme->admin_header_bottom() -themes/admin_wind/views/admin.html.php 68 DIRTY $content -themes/admin_wind/views/admin.html.php 74 DIRTY $sidebar -themes/admin_wind/views/admin.html.php 79 DIRTY $theme->admin_footer() -themes/admin_wind/views/admin.html.php 82 DIRTY $theme->admin_credits() -themes/admin_wind/views/admin.html.php 87 DIRTY $theme->admin_page_bottom() +themes/admin_wind/views/admin.html.php 21 DIRTY_JS $theme->url() +themes/admin_wind/views/admin.html.php 38 DIRTY $theme->admin_head() +themes/admin_wind/views/admin.html.php 42 DIRTY $theme->admin_page_top() +themes/admin_wind/views/admin.html.php 50 DIRTY $theme->admin_header_top() +themes/admin_wind/views/admin.html.php 51 DIRTY_JS item::root()->url() +themes/admin_wind/views/admin.html.php 54 DIRTY $theme->user_menu() +themes/admin_wind/views/admin.html.php 57 DIRTY $theme->admin_menu() +themes/admin_wind/views/admin.html.php 60 DIRTY $theme->admin_header_bottom() +themes/admin_wind/views/admin.html.php 67 DIRTY $content +themes/admin_wind/views/admin.html.php 73 DIRTY $sidebar +themes/admin_wind/views/admin.html.php 78 DIRTY $theme->admin_footer() +themes/admin_wind/views/admin.html.php 81 DIRTY $theme->admin_credits() +themes/admin_wind/views/admin.html.php 86 DIRTY $theme->admin_page_bottom() themes/admin_wind/views/block.html.php 3 DIRTY_ATTR $anchor themes/admin_wind/views/block.html.php 5 DIRTY $id themes/admin_wind/views/block.html.php 5 DIRTY_ATTR $css_id @@ -399,17 +399,17 @@ themes/wind/views/dynamic.html.php 29 DIRTY $theme themes/wind/views/movie.html.php 5 DIRTY $theme->paginator() themes/wind/views/movie.html.php 9 DIRTY $item->movie_img(array("class"=>"g-movie","id"=>"g-item-id-{$item->id}")) themes/wind/views/page.html.php 9 DIRTY $page_title -themes/wind/views/page.html.php 33 DIRTY_JS $theme->url() -themes/wind/views/page.html.php 42 DIRTY $new_width -themes/wind/views/page.html.php 43 DIRTY $new_height -themes/wind/views/page.html.php 44 DIRTY $thumb_proportion -themes/wind/views/page.html.php 81 DIRTY $header_text -themes/wind/views/page.html.php 83 DIRTY_JS item::root()->url() -themes/wind/views/page.html.php 87 DIRTY $theme->user_menu() -themes/wind/views/page.html.php 108 DIRTY_JS $parent->url($parent->id==$theme->item()->parent_id?"show={$theme->item()->id}":null) -themes/wind/views/page.html.php 129 DIRTY $content -themes/wind/views/page.html.php 135 DIRTY newView("sidebar.html") -themes/wind/views/page.html.php 142 DIRTY $footer_text +themes/wind/views/page.html.php 32 DIRTY_JS $theme->url() +themes/wind/views/page.html.php 41 DIRTY $new_width +themes/wind/views/page.html.php 42 DIRTY $new_height +themes/wind/views/page.html.php 43 DIRTY $thumb_proportion +themes/wind/views/page.html.php 80 DIRTY $header_text +themes/wind/views/page.html.php 82 DIRTY_JS item::root()->url() +themes/wind/views/page.html.php 86 DIRTY $theme->user_menu() +themes/wind/views/page.html.php 107 DIRTY_JS $parent->url($parent->id==$theme->item()->parent_id?"show={$theme->item()->id}":null) +themes/wind/views/page.html.php 128 DIRTY $content +themes/wind/views/page.html.php 134 DIRTY newView("sidebar.html") +themes/wind/views/page.html.php 141 DIRTY $footer_text themes/wind/views/paginator.html.php 33 DIRTY_JS $first_page_url themes/wind/views/paginator.html.php 42 DIRTY_JS $previous_page_url themes/wind/views/paginator.html.php 70 DIRTY_JS $next_page_url |