setup tests
This commit is contained in:
		
							parent
							
								
									7bfc959547
								
							
						
					
					
						commit
						2600ef042b
					
				| @ -195,7 +195,7 @@ class CronUploader extends Extension { | |||||||
| 		 | 		 | ||||||
| 		// Sets new default dir if not in config yet/anymore
 | 		// Sets new default dir if not in config yet/anymore
 | ||||||
| 		if ($dir == "") { | 		if ($dir == "") { | ||||||
| 			$dir = $_SERVER ['DOCUMENT_ROOT'] . "/data/cron_uploader"; | 			$dir = data_path("cron_uploader"); | ||||||
| 			$config->set_string ('cron_uploader_dir', $dir); | 			$config->set_string ('cron_uploader_dir', $dir); | ||||||
| 		} | 		} | ||||||
| 			 | 			 | ||||||
|  | |||||||
| @ -1,31 +1,39 @@ | |||||||
| <?php | <?php | ||||||
| class SetupTest { | class SetupTest extends ShimmiePHPUnitTestCase { | ||||||
| 	function testAuth() { | 	function testNiceUrlsTest() { | ||||||
| 		$this->get_page('setup'); |  | ||||||
| 		$this->assert_response(403); |  | ||||||
| 		$this->assert_title("Permission Denied"); |  | ||||||
| 
 |  | ||||||
| 		# XXX: this only checks that the text is "ok", to check
 | 		# XXX: this only checks that the text is "ok", to check
 | ||||||
| 		# for a bug where it was coming out as "\nok"; it doesn't
 | 		# for a bug where it was coming out as "\nok"; it doesn't
 | ||||||
| 		# check that niceurls actually work
 | 		# check that niceurls actually work
 | ||||||
| 		$raw = $this->get_page('nicetest'); | 		$this->get_page('nicetest'); | ||||||
| 		$this->assertTrue($raw == "ok"); | 		$this->assert_content("ok"); | ||||||
|  | 		$this->assert_no_content("\n"); | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
|  | 	function testAuthAnon() { | ||||||
|  | 		$this->get_page('setup'); | ||||||
|  | 		$this->assert_response(403); | ||||||
|  | 		$this->assert_title("Permission Denied"); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	function testAuthUser() { | ||||||
| 		$this->log_in_as_user(); | 		$this->log_in_as_user(); | ||||||
| 		$this->get_page('setup'); | 		$this->get_page('setup'); | ||||||
| 		$this->assert_response(403); | 		$this->assert_response(403); | ||||||
| 		$this->assert_title("Permission Denied"); | 		$this->assert_title("Permission Denied"); | ||||||
| 		$this->log_out(); | 	} | ||||||
| 
 | 
 | ||||||
|  | 	function testAuthAdmin() { | ||||||
| 		$this->log_in_as_admin(); | 		$this->log_in_as_admin(); | ||||||
| 		$this->get_page('setup'); | 		$this->get_page('setup'); | ||||||
| 		$this->assert_title("Shimmie Setup"); | 		$this->assert_title("Shimmie Setup"); | ||||||
| 		$this->assert_text("General"); | 		$this->assert_text("General"); | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
|  | 	function testAdvanced() { | ||||||
|  | 		$this->log_in_as_admin(); | ||||||
| 		$this->get_page('setup/advanced'); | 		$this->get_page('setup/advanced'); | ||||||
| 		$this->assert_title("Shimmie Setup"); | 		$this->assert_title("Shimmie Setup"); | ||||||
| 		$this->assert_text("thumb_quality"); | 		$this->assert_text("thumb_quality"); | ||||||
| 		$this->log_out(); |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,18 +1,23 @@ | |||||||
| <?php | <?php | ||||||
| class SiteDescriptionTest { | class SiteDescriptionTest extends ShimmiePHPUnitTestCase { | ||||||
| 	function testSiteDescription() { | 	function testSiteDescription() { | ||||||
| 		$this->log_in_as_admin(); | 		global $config, $page; | ||||||
| 		$this->get_page('setup'); | 		$config->set_string("site_description", "A Shimmie testbed"); | ||||||
| 		$this->assert_title("Shimmie Setup"); | 		$this->get_page("post/list"); | ||||||
| 		$this->set_field("_config_site_description", "A Shimmie testbed"); | 		$this->assertContains( | ||||||
| 		$this->set_field("_config_site_keywords", "foo,bar,baz"); | 			'<meta name="description" content="A Shimmie testbed">', | ||||||
| 		$raw = $this->click("Save Settings"); | 			$page->html_headers | ||||||
|  | 		); | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 		$header = '<meta name="description" content="A Shimmie testbed">'; | 	function testSiteKeywords() { | ||||||
| 		$this->assertTrue(strpos($raw, $header) > 0); | 		global $config, $page; | ||||||
| 		$this->assertTrue(strpos($raw, "foo") > 0); | 		$config->set_string("site_keywords", "foo,bar,baz"); | ||||||
| 
 | 		$this->get_page("post/list"); | ||||||
| 		$this->log_out(); | 		$this->assertContains( | ||||||
|  | 			'<meta name="keywords" content="foo,bar,baz">', | ||||||
|  | 			$page->html_headers | ||||||
|  | 		); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user