Permalink
Browse files

Add tests for email address passed to create wall

  • Loading branch information...
birtles committed Mar 19, 2013
1 parent 226a2de commit b201c465c6b2b9034c227e21fe46a6dbe01328fd
Showing with 17 additions and 6 deletions.
  1. +3 −2 wall/lib/walls.inc
  2. +13 −3 wall/tests/api/TestCreateWall.php
  3. +1 −1 wall/tests/api/WallMakerTestCase.php
View
@@ -583,7 +583,8 @@ class Wall {
'wallUrl', 'wallShortUrl',
'editorUrl', 'editorShortUrl',
'duration', 'defaultDuration',
- 'passcodeLen', 'latestSession');
+ 'ownerEmail', 'passcodeLen',
+ 'latestSession');
$result = array();
foreach ($keys as $localKey => $keyToExport) {
@@ -809,7 +810,7 @@ class Walls {
. ' ,eventName, eventDescr, eventLocation, eventType, eventFinish'
. ' ,urlPath, shortUrl, editorShortUrl'
. ' ,walls.duration, galleryDisplay, passcode'
- . ' ,designs.duration AS defaultduration'
+ . ' ,designs.duration AS defaultDuration'
. ' ,users.email AS ownerEmail'
. ' ,sessionId, beginDate as sessionStart, endDate as sessionEnd'
. ' FROM walls'
@@ -118,9 +118,19 @@ function testUrl() {
}
function testEmail() {
- // Test a bad email is rejected
- // Test the ownerEmail returned is set to the email we passed in (after
- // trimming)
+ $this->login();
+
+ // Test the ownerEmail returned is set to the email we passed in
+ $wall = $this->_createWall('Test wall', $this->testDesignId);
+ $this->assertEqual(@$wall['ownerEmail'], $this->userEmail);
+ $this->removeWall($wall['wallId']);
+
+ // Try a bad email
+ $this->logout();
+ $this->userEmail = 'abc';
+ $this->login();
+ $wall = $this->_createWall('Test wall', $this->testDesignId);
+ $this->assertEqual(@$wall['error_key'], 'bad-email');
}
function testDesignId() {
@@ -61,7 +61,7 @@ function login() {
// cache limiting headers
session_start();
- $_SESSION['email'] = 'test@test.org';
+ $_SESSION['email'] = $this->userEmail;
// We're about to call into the wall server which will want to access the
// same session but session files are opened exclusively so we store the

0 comments on commit b201c46

Please sign in to comment.