Beispiel #1
0
def test_make_address_tag(_dict, expected_content):
    melding = make_melding(_dict)
    generatedxml = melding.forretningsAdresse.toxml(
        element_name='forretningsAdresse')

    stripped = strip_default_namespace(generatedxml)
    assert expected_content in stripped
Beispiel #2
0
def test_if_able_to_set_J_in_changebylaws_field():
    melding = make_melding(CORRECT_BYLAWS_DICT)
    xml = strip_default_namespace(melding.toxml(element_name='melding'))
    wanted = "<endringMeldt>J</endringMeldt>"
    unwanted_N = "<endringMeldt>N</endringMeldt>"
    assert wanted in xml
    assert unwanted_N not in xml
Beispiel #3
0
def test_if_unable_to_set_N_in_changebylaws_field():
    melding = make_melding(wrong_changebylaws_field)
    xml = strip_default_namespace(melding.toxml(element_name='melding'))
    unwanted_N = "<endringMeldt>N</endringMeldt>"
    unwanted_J = "<endringMeldt>J</endringMeldt>"
    assert unwanted_N not in xml
    assert unwanted_J not in xml
Beispiel #4
0
def test_identical_addresses(_dict, expected_content):
    melding = make_melding(_dict)
    generatedxml = melding.toxml(element_name='melding')
    stripped = strip_default_namespace(generatedxml)
    assert expected_content in stripped
    assert 'PADR' not in stripped
Beispiel #5
0
def test_make_prokura_tag(_dict, expected_content):
    melding = make_melding(_dict)
    generatedxml = melding.prokura.toxml(element_name='prokura')
    stripped = strip_default_namespace(generatedxml)
    assert expected_content in stripped
Beispiel #6
0
def test_make_signatur_tag(_dict, expected_content):
    melding = make_melding(_dict)
    generatedxml = melding.signatur.toxml(element_name='signatur')
    stripped = strip_default_namespace(generatedxml)
    assert expected_content in stripped
Beispiel #7
0
def test_fail_make_elektroniskAdresse_tag(_dict, expected_content):
    melding = make_melding(_dict)
    generatedxml = melding.toxml(element_name='melding')

    stripped = strip_default_namespace(generatedxml)
    assert expected_content not in stripped
Beispiel #8
0
def test_make_opplysningUtgaar_tag(_dict, expected_content):
    melding = make_melding(_dict)
    generatedxml = melding.toxml(element_name='melding')

    stripped = strip_default_namespace(generatedxml)
    assert expected_content in stripped
Beispiel #9
0
def test_make_kontaktpers_tag(_dict, expected_content):
    melding = make_melding(_dict)
    generatedxml = melding.kontaktperson.toxml(element_name='kontaktperson')

    stripped = strip_default_namespace(generatedxml)
    assert expected_content in stripped
Beispiel #10
0
def test_make_mobile_tag(_dict, expected_content):
    melding = make_melding(_dict)
    generatedxml = melding.mobil.toxml(element_name='mobil')

    stripped = strip_default_namespace(generatedxml)
    assert expected_content in stripped
Beispiel #11
0
def test_make_email_tag(_dict, expected_content):
    melding = make_melding(_dict)
    generatedxml = melding.epost.toxml(element_name='epost')

    stripped = strip_default_namespace(generatedxml)
    assert expected_content in stripped
Beispiel #12
0
def test_make_website_tag(_dict, expected_content):
    melding = make_melding(_dict)
    generatedxml = melding.hjemmeside.toxml(element_name='hjemmeside')

    stripped = strip_default_namespace(generatedxml)
    assert expected_content in stripped
Beispiel #13
0
def test_make_date_tag(_dict, expected_content):
    melding = make_melding(_dict)
    generatedxml = melding.stiftelsesdato.toxml(element_name='stiftelsesdato')
    stripped = strip_default_namespace(generatedxml)
    assert expected_content in stripped
Beispiel #14
0
def test_make_header(_dict, expected_content):
    header = make_header(_dict['header'])
    xmlheader = header.toxml(element_name='header')
    stripped = strip_default_namespace(xmlheader)
    assert expected_content in stripped
Beispiel #15
0
def test_xml_generation():
    # Testing that XML can be successfully created from this dataset,
    # without throwing an error.
    melding = make_melding(AA_DICT)
    complete_melding = ""

    generatedxml = melding.navn.toxml(element_name='navn')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.stiftelsesdato.toxml(element_name='stiftelsesdato')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.forretningsAdresse.toxml(
        element_name='forretningsAdresse')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.hjemmeside.toxml(element_name='hjemmeside')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.epost.toxml(element_name='epost')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.telefon.toxml(element_name='telefon')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.mobil.toxml(element_name='mobil')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.telefaks.toxml(element_name='telefaks')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.formaal.toxml(element_name='formaal')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.kontaktperson.toxml(element_name='kontaktperson')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.dagligLeder.toxml(element_name='dagligLeder')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.styre.toxml(element_name='styre')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.signatur.toxml(element_name='signatur')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.maalform.toxml(element_name='maalform')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.ansatte.toxml(element_name='ansatte')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.grasrotandel.toxml(element_name='grasrotandel')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    c = 0
    for k in melding.kategori:
        k_xml = k.toxml(element_name='kategori')
        stripped = strip_default_namespace(k_xml)
        complete_melding += stripped
        c += 1

    generatedxml = melding.kontonummer.toxml(element_name='kontonummer')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.meldepliktVedtekter.toxml(
        element_name='meldepliktVedtekter')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.aarsregnskapLeveres.toxml(
        element_name='aarsregnskapLeveres')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    generatedxml = melding.regnskapsperiode.toxml(
        element_name='regnskapsperiode')
    stripped = strip_default_namespace(generatedxml)
    complete_melding += stripped

    c = 0
    for v in melding.vedlegg:
        v_xml = v.toxml(element_name='vedlegg')
        stripped = strip_default_namespace(v_xml)
        complete_melding += stripped
        c += 1

    c = 0
    for s in melding.signerer:
        s_xml = s.toxml(element_name='signerer')
        stripped = strip_default_namespace(s_xml)
        complete_melding += stripped
        c += 1

    xml = complete_melding.replace(
        ' xmlns="http://schema.brreg.no/intef/integrasjonERFV"', '')
    xml = xml.replace('<?xml version="1.0" ?>', '')