public function SparkpostTestCase::testAdminAccess in Sparkpost email 7.2
Same name and namespace in other branches
- 7 tests/sparkpost.test \SparkpostTestCase::testAdminAccess()
Access admin pages.
File
- tests/
sparkpost.test, line 57 - Test class for the Sparkpost module.
Class
- SparkpostTestCase
- @file Test class for the Sparkpost module.
Code
public function testAdminAccess() {
$this
->drupalLogout();
$this
->drupalLogin($this->user);
// Try access sparkpost admin form.
$this
->drupalGet('admin/config/services/sparkpost');
$this
->assertResponse(403);
// Login as admin.
$this
->drupalLogout();
$this
->drupalLogin($this->admin);
// Try access sparkpost admin form.
$this
->drupalGet('admin/config/services/sparkpost');
$this
->assertResponse(200);
// Try access test form.
$this
->drupalGet('admin/config/services/sparkpost/test');
$this
->assertResponse(403);
// Set dummy access key.
variable_set('sparkpost_api_key', 'API_KEY');
// Try access test form.
$this
->drupalGet('admin/config/services/sparkpost/test');
$this
->assertResponse(200);
}