From 6758bb5a442f5a3ca2db2cbfc9259351e3047866 Mon Sep 17 00:00:00 2001 From: David Kilias Date: Sun, 6 Dec 2020 21:35:39 +0100 Subject: [PATCH] test case in datei ausgelagert --- test.py | 42 ++----------------------------------- test_cases/valid/valid.json | 36 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 40 deletions(-) create mode 100644 test_cases/valid/valid.json diff --git a/test.py b/test.py index 06c0165..43dd022 100644 --- a/test.py +++ b/test.py @@ -58,49 +58,11 @@ class TestValidation(tornado.testing.AsyncHTTPTestCase): self.assertFalse(validation_result['valid'], "Validation result is expected to be valid==false") def test_valid_entity(self): - entity = { - 'finanzdaten': - { - 'bic': 'PBNKDEFFXXX', - 'holder': '', - 'iban': 'DE89370400440532013000', - 'issuance': '2012-01-01', - 'reference': '0042', - 'scan-sepa-mandate': '' - }, - 'mitgliederdaten': - { - 'bis': '', - 'mitgliedsbeitrag': '30', - 'scan-antrag': '', - 'schliessberechtigung': 'Ja', - 'spendenbeitrag': '0', - 'status': 'V', - 'von': '2012-01-01' - }, - 'stammdaten': - { - 'address_code': '39104', - 'address_country': 'DE', - 'address_label': 'Max Hackerberg\nLeibnizstr. 32\n39104 Magdeburg', - 'address_locality': 'Magdeburg', - 'address_region': '', - 'address_street': 'Leibnizstr. 32', - 'birth_date': '1970-01-01', - 'birth_location': 'Hackstadt', - 'email': 'max.hackerberg@netz39.de', - 'fullname': 'Max Hackerberg', - 'nickname': 'maxH', - 'pgp-key': '', - 'ssh-key': '' - }, - 'timestamp': '2020-03-25T23:58:11', - 'id': '6af68' - } + entity_file = json.load(open('test_cases/valid/valid.json','r')) response = self.fetch('/v0/validate', method='POST', - body=json.dumps(entity)) + body=json.dumps(entity_file)) self.assertEqual(200, response.code, "Validation must always return 200") diff --git a/test_cases/valid/valid.json b/test_cases/valid/valid.json new file mode 100644 index 0000000..d11361e --- /dev/null +++ b/test_cases/valid/valid.json @@ -0,0 +1,36 @@ +{ + "finanzdaten": { + "bic": "PBNKDEFFXXX", + "holder": "", + "iban": "DE89370400440532013000", + "issuance": "2012-01-01", + "reference": "0042", + "scan-sepa-mandate": "" + }, + "mitgliederdaten": { + "bis": "", + "mitgliedsbeitrag": "30", + "scan-antrag": "", + "schliessberechtigung": "Ja", + "spendenbeitrag": "0", + "status": "V", + "von": "2012-01-01" + }, + "stammdaten": { + "address_code": "39104", + "address_country": "DE", + "address_label": "Max Hackerberg\nLeibnizstr. 32\n39104 Magdeburg", + "address_locality": "Magdeburg", + "address_region": "", + "address_street": "Leibnizstr. 32", + "birth_date": "1970-01-01", + "birth_location": "Hackstadt", + "email": "max.hackerberg@netz39.de", + "fullname": "Max Hackerberg", + "nickname": "maxH", + "pgp-key": "", + "ssh-key": "" + }, + "timestamp": "2020-03-25T23:58:11", + "id": "6af68" +} \ No newline at end of file