def test_update_project(self):

    class FakeItem(object):

        def __init__(self, name, id):
            self.name = name
            self.id = id
    conf = dummy_conf()
    s = StoryboardOps(conf, None)
    patches = [patch('storyboardclient.v1.projects.ProjectsManager.get_all'), patch('storyboardclient.v1.projects.ProjectsManager.update'), patch('storyboardclient.v1.projects.ProjectsManager.create')]
    with nested(*patches) as (get_all, update, create):
        get_all.return_value = [FakeItem('project1', 1)]
        s.update_project('project1', 'A desc')
        self.assertTrue(get_all.called)
        self.assertTrue(update.called)
        self.assertFalse(create.called)
    with nested(*patches) as (get_all, update, create):
        get_all.return_value = [FakeItem('project1', 1)]
        s.update_project('project2', 'A desc')
        self.assertTrue(get_all.called)
        self.assertFalse(update.called)
        self.assertTrue(create.called)
def test_update_project(self):

    class FakeItem(object):

        def __init__(self, name, id):
            self.name = name
            self.id = id
    conf = dummy_conf()
    s = StoryboardOps(conf, None)
    patches = [patch('storyboardclient.v1.projects.ProjectsManager.get_all'), patch('storyboardclient.v1.projects.ProjectsManager.update'), patch('storyboardclient.v1.projects.ProjectsManager.create')]
    with nested(*patches) as (get_all, update, create):
        get_all.return_value = [FakeItem('project1', 1)]
        s.update_project('project1', 'A desc')
        self.assertTrue(get_all.called)
        self.assertTrue(update.called)
        self.assertFalse(create.called)
    with nested(*patches) as (get_all, update, create):
        get_all.return_value = [FakeItem('project1', 1)]
        s.update_project('project2', 'A desc')
        self.assertTrue(get_all.called)
        self.assertFalse(update.called)
        self.assertTrue(create.called)