g7r = self._api.get_cpu_generator(self._g7r.id) expect(g7r).to(be_valid_cpu_generator) expect(g7r.running).to(be_true) with included_context('start generator'): pass with description('already running generator'): with it('bad request (400)'): expr = lambda: self._api.start_cpu_generator(self._g7r.id) expect(expr).to(raise_api_exception(400)) with description('with Dynamic Results'): with before.all: self._api.stop_cpu_generator(self._g7r.id) dynamic = make_dynamic_results_config( get_cpu_dynamic_results_fields(self._g7r.config)) self._result = self._api.start_cpu_generator_with_http_info( self._g7r.id, dynamic_results=dynamic, _return_http_data_only=False) with included_context('start generator'): with it('has valid dynamic results'): expect(self._result[0].dynamic_results).to(be_valid_dynamic_results) with description('by non-existent ID'): with it('not found (404)'): expr = lambda: self._api.start_cpu_generator('unknown') expect(expr).to(raise_api_exception(404)) with description('by invalid ID'): with it('bad request (400)'): expr = lambda: self._api.start_cpu_generator('bad_id')
self.gen.id) expect(result[1]).to(equal(201)) expect(result[2]).to( has_location('/block-generator-results/' + result[0].id)) expect(result[0]).to(be_valid_block_generator_result) with description('running generator,'): with it('returns 400'): self.api.start_block_generator(self.gen.id) expect(lambda: self.api.start_block_generator(self.gen.id) ).to(raise_api_exception(400)) with description('by existing ID with Dynamic Results'): with it('started'): dynamic = make_dynamic_results_config( get_block_dynamic_results_fields()) result = self.api.start_block_generator_with_http_info( self.gen.id, dynamic_results=dynamic, _return_http_data_only=False) expect(result[1]).to(equal(201)) expect(result[2]).to( has_location('/block-generator-results/' + result[0].id)) expect(result[0]).to(be_valid_block_generator_result) expect(result[0].active).to(be_true) expect(result[0].generator_id).to(equal(self.gen.id)) expect( result[0].dynamic_results).to(be_valid_dynamic_results) with description('non-existent id,'):
expect(g7r).to(be_valid_memory_generator) expect(g7r.running).to(be_true) with included_context('start generator'): pass with description('already running generator'): with it('bad request (400)'): expr = lambda: self._api.start_memory_generator( self._g7r.id) expect(expr).to(raise_api_exception(400)) with description('with Dynamic Results'): with before.all: self._api.stop_memory_generator(self._g7r.id) dynamic = make_dynamic_results_config( get_memory_dynamic_results_fields()) self._result = self._api.start_memory_generator_with_http_info( self._g7r.id, dynamic_results=dynamic, _return_http_data_only=False) with included_context('start generator'): with it('has valid dynamic results'): expect(self._result[0].dynamic_results).to( be_valid_dynamic_results) with description('by non-existent ID'): with it('not found (404)'): expr = lambda: self._api.start_memory_generator( 'unknown') expect(expr).to(raise_api_exception(404))