-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from pennlabs/laundry-refactor
Laundry refactor looks good to me. Begins to fix #4.
- Loading branch information
Showing
2 changed files
with
86 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
import unittest | ||
from nose.tools import ok_, eq_ | ||
from penn import Laundry | ||
|
||
|
||
class TestLaundry(unittest.TestCase): | ||
class TestLaundry(): | ||
|
||
def setUp(self): | ||
self.laundry = Laundry() | ||
|
||
def test_all(self): | ||
data = self.laundry.all_status() | ||
self.assertEquals('Class of 1925 House', data[0]['name']) | ||
self.assertEquals(55, len(data)) | ||
eq_(55, len(data)) | ||
eq_('Class of 1925 House', data[0]['name']) | ||
# Check all halls have appropriate data points | ||
for i, hall in enumerate(data): | ||
eq_(hall['hall_no'], i) | ||
ok_(hall['dryers_available'] >= 0) | ||
ok_(hall['dryers_in_use'] >= 0) | ||
ok_(hall['washers_available'] >= 0) | ||
ok_(hall['washers_in_use'] >= 0) | ||
|
||
def test_single_hall(self): | ||
for i in range(5): | ||
for i in range(1): | ||
data = self.laundry.hall_status(i) | ||
self.assertEquals(data['machines'][0]['number'], '1') | ||
machines = data['machines'] | ||
# Check all machines have appropriate data points | ||
for i, machine in enumerate(machines): | ||
eq_(machine['number'], str(i + 1)) | ||
ok_('available' in machine) | ||
ok_('machine_type' in machine) | ||
ok_('time_left' in machine) |