def test_005_update_challenge(self): challenge = MapRouletteChallenge( slug=self.test_challenge_slug, title='Test Challenge Updated', active=True ) challenge.update(self.server)
def test_003_create_challenge(self): challenge = MapRouletteChallenge( slug=self.test_challenge_slug, title='Test Challenge' ) self.assertFalse(challenge.exists(self.server)) challenge.create(self.server) self.assertTrue(challenge.exists(self.server))
def test_009_retrieve_taskcollection_from_server(self): challenge = MapRouletteChallenge.from_server( self.server, self.test_challenge_slug) task_collection = MapRouletteTaskCollection.from_server( self.server, challenge) self.assertTrue(len(task_collection.tasks) == self.A_TON + 1)
def test_007_task_exists(self): challenge = MapRouletteChallenge.from_server( self.server, self.test_challenge_slug) task = MapRouletteTask( challenge=challenge, identifier=self.test_task_identifier) print task self.assertTrue(task.exists(self.server))
def test_006_create_task(self): challenge = MapRouletteChallenge.from_server( self.server, self.test_challenge_slug) task = MapRouletteTask( challenge=challenge, identifier=self.test_task_identifier, geometries=self.__random_point()) task.create(self.server)
def test_011_delete_challenge(self): """ Delete the challenge that was created for this test """ # get the challenge from server challenge = MapRouletteChallenge.from_server( self.server, self.test_challenge_slug) challenge.delete(self.server)
def test_010_reconcile_task_collections(self): """ In this test case, we will reconcile a task collection with an existing one on the server (created in 008). Compared to the existing task collection, we will remove one task, add one task, and change one task. """ # get the challenge from server challenge = MapRouletteChallenge.from_server( self.server, self.test_challenge_slug) # get the task collection to reconcile, start out with the # existing one on the server task_collection = MapRouletteTaskCollection.from_server( self.server, challenge) # remove the last task, so it appears 'deleted' task_collection.tasks.pop() # append a different task in place, so it appears 'new' task_collection.tasks.append( MapRouletteTask( challenge=challenge, identifier='task-{}'.format(uuid.uuid4()), geometries=self.__random_point())) # and finally change one task so it appears 'updated' task_collection.tasks[0].geometries = self.__random_point() task_collection.tasks[0].status = 'changed' # reconcile the two collections result = task_collection.reconcile(self.server) # assert that we indeed have one new, one changed and one deleted task. self.assertTrue(len(result['new']) == 1) self.assertTrue(len(result['changed']) == 1) self.assertTrue(len(result['deleted']) == 1)
def test_008_create_a_ton_of_tasks(self): challenge = MapRouletteChallenge.from_server( self.server, self.test_challenge_slug) task_collection = self.__create_task_collection(challenge) task_collection.create(self.server)
def test_004_retrieve_challenge(self): MapRouletteChallenge.from_server( self.server, self.test_challenge_slug)