~ubuntu-drupal-devs/drupal-launchpad/6.x-dev

« back to all changes in this revision

Viewing changes to tests/module.test

  • Committer: Stuart Metcalfe
  • Date: 2009-03-01 20:09:57 UTC
  • Revision ID: stuartm@stu-20090301200957-h25eppoqeuk84kje
Added more tests for registation page access

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    $result = prevent_non_openid_registrations();
31
31
    $this->assertFalse($result);
32
32
  }
 
33
 
 
34
  function testDrupalLaunchpadDetectOpenIDSuccessResponse() {
 
35
    $_SESSION['openid']['values']['response']['status'] = 'success';
 
36
    $result = registration_request_from_openid_response();
 
37
    $this->assertTrue($result);
 
38
  }
 
39
 
 
40
  function testDrupalLaunchpadDetectOpenIDFailedResponse() {
 
41
    $_SESSION['openid']['values']['response']['status'] = 'failed';
 
42
    $result = registration_request_from_openid_response();
 
43
    $this->assertFalse($result);
 
44
  }
 
45
 
 
46
  function testDrupalLaunchpadDetectOpenIDCancelResponse() {
 
47
    $_SESSION['openid']['values']['response']['status'] = 'cancel';
 
48
    $result = registration_request_from_openid_response();
 
49
    $this->assertFalse($result);
 
50
  }
 
51
 
 
52
  function testDrupalLaunchpadDetectNonOpenIDResponse() {
 
53
    unset($_SESSION['openid']);
 
54
    $result = registration_request_from_openid_response();
 
55
    $this->assertFalse($result);
 
56
  }
 
57
 
 
58
  function testDrupalLaunchpadShouldShowRegisterFormWhenRegistrationAllowed() {
 
59
    variable_set('openid_launchpad_prevent_register', false);
 
60
    unset($_SESSION['openid']);
 
61
    $result = should_show_register_form();
 
62
    $this->assertTrue($result);
 
63
  }
 
64
 
 
65
  function testDrupalLaunchpadShouldShowRegisterFormWhenRegistrationNotAllowedAndOpenID() {
 
66
    variable_set('openid_launchpad_prevent_register', true);
 
67
    $_SESSION['openid']['values']['response']['status'] = 'success';
 
68
    $result = should_show_register_form();
 
69
    $this->assertTrue($result);
 
70
  }
 
71
 
 
72
  function testDrupalLaunchpadShouldNotShowRegisterFormWhenRegistrationNotAllowedAndNoOpenID() {
 
73
    variable_set('openid_launchpad_prevent_register', true);
 
74
    unset($_SESSION['openid']);
 
75
    $result = should_show_register_form();
 
76
    $this->assertFalse($result);
 
77
  }
 
78
 
 
79
  function tearDown() {
 
80
    variable_del('openid_launchpad_prevent_register');
 
81
    unset($_SESSION['openid']);
 
82
    parent::tearDown();
 
83
  }
33
84
}