Skip to content

Commit

Permalink
Add tests for email address passed to create wall
Browse files Browse the repository at this point in the history
  • Loading branch information
birtles committed Mar 19, 2013
1 parent 226a2de commit b201c46
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
5 changes: 3 additions & 2 deletions wall/lib/walls.inc
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,8 @@ class Wall {
'wallUrl', 'wallShortUrl',
'editorUrl', 'editorShortUrl',
'duration', 'defaultDuration',
'passcodeLen', 'latestSession');
'ownerEmail', 'passcodeLen',
'latestSession');

$result = array();
foreach ($keys as $localKey => $keyToExport) {
Expand Down Expand Up @@ -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'
Expand Down
16 changes: 13 additions & 3 deletions wall/tests/api/TestCreateWall.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion wall/tests/api/WallMakerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b201c46

Please sign in to comment.