def test_get(self): """ Create a new step, then get it back using the received id. """ context = yield create_context(copy.deepcopy(self.dummyContext), 'en') step = copy.deepcopy(self.dummySteps[0]) step['context_id'] = context['id'] step = yield create_step(step, 'en') handler = self.request(role='admin') yield handler.get(step['id']) self.assertEqual(len(self.responses), 1) self.assertEqual(step['id'], self.responses[0]['id'])
def test_delete(self): """ Create a new step, then attempt to delete it. """ context = yield create_context(copy.deepcopy(self.dummyContext), 'en') step = copy.deepcopy(self.dummySteps[0]) step['context_id'] = context['id'] step = yield create_step(step, 'en') handler = self.request(role='admin') yield handler.delete(step['id']) self.assertEqual(handler.get_status(), 200) # second deletion operation should fail self.assertFailure(handler.delete(step['id']), errors.StepIdNotFound)
def test_put(self): """ Attempt to update a step, changing it presentation order """ context = yield create_context(copy.deepcopy(self.dummyContext), 'en') step = copy.deepcopy(self.dummySteps[0]) step['context_id'] = context['id'] step = yield create_step(step, 'en') step['presentation_order'] = 666 handler = self.request(step, role='admin') yield handler.put(step['id']) self.assertEqual(len(self.responses), 1) self.assertEqual(step['id'], self.responses[0]['id']) self.assertEqual(self.responses[0]['presentation_order'], 666)