def test_dispatch(self): with open('tests/app/elster/sample_with_auth.xml', 'r') as f: input_xml = f.read() session = gen_random_key() result = run_pyeric(input_xml, session, app.config['CERT_PIN'], "ESt_2019") self.assertIn(session, str(result.session_folder))
def test_04_widowed(self): form_data = {} form_data.update(_BASE_DATA_PERSON_A) form_data.update({ 'familienstand': 'widowed', 'familienstand_date': datetime.date(2000, 1, 31), }) response = validate_with_elster(form_data, gen_random_key()) self.assertIsNotNone(response)
def test_03_divorced_rel_rk(self): form_data = {} form_data.update(_BASE_DATA_PERSON_A) form_data.update({ 'person_a_religion': 'rk', 'familienstand': 'divorced', 'familienstand_date': datetime.date(2000, 1, 31), }) response = validate_with_elster(form_data, gen_random_key()) self.assertIsNotNone(response)
def test_06_with_person_b_same_address(self): form_data = {} form_data.update(_BASE_DATA_PERSON_A) form_data.update(_BASE_DATA_PERSON_B) form_data.update({ 'familienstand': 'married', 'familienstand_date': datetime.date(2000, 1, 31), }) response = validate_with_elster(form_data, gen_random_key()) self.assertIsNotNone(response)
def get_or_create(self, identifier, default_data={}): """Returns the data associated with the `identifier`. If the identifier is unknown, a new entry will be created with the given `default_data` and returned. In each case the TTL countdown will be reset. """ if identifier: json = self._load_session(identifier) if json != None: return identifier, self._from_json(json) # If no identifier provided or no entry # -> create new one with empty data identifier = gen_random_key() if self._has_session(identifier): # TODO handle properly raise KeyError("key collision") data = default_data json = self._to_json(data) self._save_session(identifier, json) return identifier, data
def test_01_not_married(self): form_data = {} form_data.update(_BASE_DATA_PERSON_A) response = validate_with_elster(form_data, gen_random_key()) self.assertIsNotNone(response)
def test_full_form_to_elster_run(self): form_data = LotseMultiStepFlow(None).debug_data()[1] session_id = gen_random_key() response = send_with_elster(form_data, session_id) self.assertIsNotNone(response)