import unittest
from mock import patch, Mock
import phabulous


class TestPhabulous(unittest.TestCase):
    "Test Phabulous."
    def setUp(self):
        "Setup test."
        self.responses = Mock()
        self.responses.configure_mock(**{
            'user.query.return_value': [{
                'phid': '1',
                'userName': 'will',
                'email': 'will@example.org',
            }],
            'maniphest.query.return_value': {
                'task-phid': {
                    'id': '2',
                    'priority': 3,
                    'statusName': 'status-open',
                    'phid': '2',
                    'title': 'task',
                    'description': 'desc',

                    },
            },
            'project.query.return_value.data': {
                'phid-1': {
                    'phid': 'phid-1',
                    'id': 'id-1',
                    'name': 'project 1',
                    'dateCreated': '1/2/3',
                    'slugs': 'slugs',
                    'dateModified': '2/3/4',
                },
            },
        })
        self.phab = phabulous.Phabulous(self.responses)

    def test_project(self):
        "Test the project object."
        project = self.phab.project(id="will")
        projects = self.phab.projects(ids=["will"])

        self.assertEquals(len(projects), 1)
        self.assertEquals(project.phid, projects[0].phid)
        self.assertEquals(project.phid, 'phid-1')
        self.assertEquals(project.id, 'id-1')

        self.assertTrue(project.tasks)
        self.assertTrue(project.members)

        for task in project.tasks:
            self.assertEquals(task.title, 'task')
            self.assertEquals(task.dependencies, [])

        for user in project.members:
            self.assertEquals(user.name, 'will')
            self.assertEquals(user.email, 'will@example.org')

    def test_user(self):
        "Test the user object."
        user = self.phab.user(username="will")
        self.assertEquals(user.name, 'will')
        self.assertEquals(user.email, 'will@example.org')
        self.assertTrue(user.tasks)
        for task in user.tasks:
            self.assertEquals(task.title, 'task')
            self.assertEquals(task.dependencies, [])


if __name__ == '__main__':
    unittest.main()

@@ -621,24 +621,29 @@
    'phid': '
+phid-
 2',%0A        
@@ -1168,24 +1168,412 @@
 responses)%0A%0A
+    def test_task(self):%0A        %22Test the task object.%22%0A        task = self.phab.task(phid='phid-2')%0A        tasks = self.phab.tasks(phid=%5B'phid-2'%5D)%0A%0A        self.assertEquals(len(tasks), 1)%0A        self.assertEquals(task.phid, tasks%5B0%5D.phid)%0A        self.assertEquals(task.phid, 'phid-2')%0A        self.assertEquals(task.title, 'task')%0A        self.assertEquals(task.dependencies, %5B%5D)%0A%0A
     def test

Add some more tests for tasks.