Example #1
0
 def test_mandatory_exception(self):
     """Raise an error when the content is empty"""
     try:
         tra = ExportTra()
         tra._mandatory('', 10)
         pytest.fail('An empty content mandatory must raise and error')
     except MandatoryException:
         pass
Example #2
0
 def test_mandatory_exception(self):
     """Raise an error when the content is empty"""
     try:
         tra = ExportTra()
         tra._mandatory('', 10)
         pytest.fail('An empty content mandatory must raise and error')
     except MandatoryException:
         pass
Example #3
0
def test_CAE_Notvalid():
    try:
        tra = ExportTra()
        tra.setHeader('S5', 'CLI', 'JRL')
        tra.addCAE('4110001', 'Client X', nature='AUZ')
        pytest.fail('Not a valid value sent, must be raise and error')
    except NotValidValue:
        pass
Example #4
0
 def test_SAT_mandatory(self):
     try:
         tra = ExportTra()
         tra.setHeader('S5', 'CLI', 'JRL')
         tra.addSAT('PROJ1', 'Projet1')
         pytest.fail('Axe content is mandatory, missing value must be raise and error')
     except MandatoryException:
         pass
Example #5
0
 def test_SAT_export(self):
     tra = ExportTra()
     tra.setHeader('S5', 'CLI', 'JRL')
     tra.addSAT('PROJ1', 'Projet1', 'Axe1')
     content = tra._content['lines'][0]
     assert content[:3] == '***', 'Bad starting record!'
     assert len(content) == 251, 'SAT Line in 007 format must containt 251 characters'
     assert content[248:] == 'M  ', 'Sens field must be set with M by default'
Example #6
0
def test_ecriture_mandatory():
    try:
        tra = ExportTra()
        tra.setHeader('S5', 'CLI', 'JRL')
        tra.addEcriture('VTE', type_piece='FC', type_compte='X', type_ecriture='N', sens='C')
        pytest.fail('Axe content is mandatory, missing value must be raise and error')
    except MandatoryException:
        pass
Example #7
0
def test_ecriture_Notvalid():
    try:
        tra = ExportTra()
        tra.setHeader('S5', 'CLI', 'JRL')
        tra.addEcriture('VTE', type_piece='FC')
        pytest.fail('Not a valid value sent, must be raise and error')
    except NotValidValue:
        pass
Example #8
0
 def test_header(self):
     tra = ExportTra()
     tra.setHeader('S5', 'CLI', 'JRL', num_dossier='B105ZZ')
     content = tra.render()
     assert position(content, 1, 3) == '***', 'Bad starting record!'
     assert position(content, 4, 2) == 'S5', 'Bad identifiant!'
     assert position(content, 18, 8) == '01011900', 'Default date for "Date Bacule" not found!'
     assert position(content, 26, 8) == '01011900', 'Default date for "Date arrete periodique" not found!'
     assert position(content, 34, 3) == '007'
     assert position(content, 37, 5) == '     '
     assert position(content, 42, 8) == time.strftime('%d%m%Y')
     assert position(content, 128, 6) == 'B105ZZ'
     assert position(content, 145, 3) == '001'
     assert len(content.replace('\r\n', '')) == 147, 'Record length not valid (%d)' % len(content)
Example #9
0
 def test_header(self):
     tra = ExportTra()
     tra.setHeader('S5', 'CLI', 'JRL', num_dossier='B105ZZ')
     content = tra.render()
     assert position(content, 1, 3) == '***', 'Bad starting record!'
     assert position(content, 4, 2) == 'S5', 'Bad identifiant!'
     assert position(
         content, 18,
         8) == '01011900', 'Default date for "Date Bacule" not found!'
     assert position(
         content, 26, 8
     ) == '01011900', 'Default date for "Date arrete periodique" not found!'
     assert position(content, 34, 3) == '007'
     assert position(content, 37, 5) == '     '
     assert position(content, 42, 8) == time.strftime('%d%m%Y')
     assert position(content, 128, 6) == 'B105ZZ'
     assert position(content, 145, 3) == '001'
     assert len(content.replace(
         '\r\n', '')) == 147, 'Record length not valid (%d)' % len(content)
Example #10
0
def test_CAE_mandatory():
    try:
        tra = ExportTra()
        tra.setHeader('S5', 'CLI', 'JRL')
        tra.addCAE('4110001', 'Client X', nature='AUC')
        tra.addEcriture('VTE',
                        type_piece='FC',
                        type_compte='X',
                        type_ecriture='N',
                        sens='C')
        pytest.fail(
            'Axe content is mandatory, missing value must be raise and error')
    except MandatoryException:
        pass
Example #11
0
def test_ecriture_normal():
    tra = ExportTra()
    tra.setHeader('S5', 'CLI', 'JRL')
    tra.addEcriture('VTE',
                    type_piece='FC',
                    compte='41110001',
                    type_compte='X',
                    type_ecriture='N',
                    sens='C',
                    code_montant='C',
                    date_creation='01012013',
                    code_affaire='AAZZBB')
    assert len(tra._content['lines']) == 1
    content = tra._content['lines'][0]
    assert position(content, 1, 3) != '***', 'Bad starting record!'
    assert position(
        content, 1,
        3) == 'VTE'  #, 'Starting record must be VTE in this exemple!'
    assert position(content, 130,
                    1) in ('C', 'D'), 'Sens must be filled with C or D'
    assert position(content, 131, 20) == '00000000000000000,00'
    assert position(content, 176, 20) == '00000000000000000,00'
    assert position(content, 196, 20) == '00000000000000000,00'
    assert position(content, 258, 8) == '01011900'
    assert position(content, 266, 8) == '01012013'
    assert position(content, 277, 17) == 'AAZZBB'.ljust(17)
    assert len(
        content
    ) == 293, 'Ecriture Line in 007 format must containt 222 characters (found %d)' % len(
        content)
Example #12
0
def test_CAE_Notvalid():
    try:
        tra = ExportTra()
        tra.setHeader('S5', 'CLI', 'JRL')
        tra.addCAE('4110001', 'Client X', nature='AUZ')
        pytest.fail('Not a valid value sent, must be raise and error')
    except NotValidValue:
        pass
Example #13
0
def test_ecriture_Notvalid():
    try:
        tra = ExportTra()
        tra.setHeader('S5', 'CLI', 'JRL')
        tra.addEcriture('VTE', type_piece='FC')
        pytest.fail('Not a valid value sent, must be raise and error')
    except NotValidValue:
        pass
Example #14
0
def test_ecriture_normal():
    tra = ExportTra()
    tra.setHeader('S5', 'CLI', 'JRL')
    tra.addEcriture('VTE',
                    type_piece='FC',
                    compte='41110001',
                    type_compte='X',
                    type_ecriture='N',
                    sens='C',
                    code_montant='C',
                    date_creation='01012013',
                    code_affaire='AAZZBB')
    assert len(tra._content['lines']) == 1
    content = tra._content['lines'][0]
    assert position(content, 1, 3) != '***', 'Bad starting record!'
    assert position(content, 1, 3) == 'VTE' #, 'Starting record must be VTE in this exemple!'
    assert position(content, 130, 1) in ('C', 'D'), 'Sens must be filled with C or D'
    assert position(content, 131, 20) == '00000000000000000,00'
    assert position(content, 176, 20) == '00000000000000000,00'
    assert position(content, 196, 20) == '00000000000000000,00'
    assert position(content, 258, 8) == '01011900'
    assert position(content, 266, 8) == '01012013'
    assert position(content, 277, 17) == 'AAZZBB'.ljust(17)
    assert len(content) == 293, 'Ecriture Line in 007 format must containt 222 characters (found %d)' % len(content)
Example #15
0
 def test_SAT_mandatory(self):
     try:
         tra = ExportTra()
         tra.setHeader('S5', 'CLI', 'JRL')
         tra.addSAT('PROJ1', 'Projet1')
         pytest.fail(
             'Axe content is mandatory, missing value must be raise and error'
         )
     except MandatoryException:
         pass
Example #16
0
 def test_SAT_export(self):
     tra = ExportTra()
     tra.setHeader('S5', 'CLI', 'JRL')
     tra.addSAT('PROJ1', 'Projet1', 'Axe1')
     content = tra._content['lines'][0]
     assert content[:3] == '***', 'Bad starting record!'
     assert len(
         content
     ) == 251, 'SAT Line in 007 format must containt 251 characters'
     assert content[
         248:] == 'M  ', 'Sens field must be set with M by default'
Example #17
0
 def test_debug(self):
     tra = ExportTra()
     tra.setDebug(200)
     assert tra._debug_header == 200, 'Bad debug header length'
Example #18
0
 def test_debug(self):
     tra = ExportTra()
     tra.setDebug(200)
     assert tra._debug_header == 200, 'Bad debug header length'
Example #19
0
 def test_format_1(self):
     tra = ExportTra()
     content = tra._format('OK', 10)
     assert len(content) == 10
     assert content[:2] == 'OK', "Content doesn't start with OK!"
Example #20
0
 def test_format_2(self):
     tra = ExportTra()
     content = tra._format('OK', 10, True)
     assert len(content) == 10
     assert content[8:] == 'OK', "Content doesn't end with OK!"
Example #21
0
 def test_format_4(self):
     tra = ExportTra()
     content = tra._format('OK', 10, True, caract='=')
     assert len(content) == 10
     assert content == '========OK'
Example #22
0
 def test_mandatory_standard(self):
     tra = ExportTra()
     content = tra._mandatory('OK', 10)
     assert len(content) == 10
Example #23
0
 def test_mandatory_standard(self):
     tra = ExportTra()
     content = tra._mandatory('OK', 10)
     assert len(content) == 10
Example #24
0
 def test_format_4(self):
     tra = ExportTra()
     content = tra._format('OK', 10, True, caract='=')
     assert len(content) == 10
     assert content == '========OK'
Example #25
0
 def test_format_1(self):
     tra = ExportTra()
     content = tra._format('OK', 10)
     assert len(content) == 10
     assert content[:2] == 'OK', "Content doesn't start with OK!"
Example #26
0
 def test_format_2(self):
     tra = ExportTra()
     content = tra._format('OK', 10, True)
     assert len(content) == 10
     assert content[8:] == 'OK', "Content doesn't end with OK!"
Example #27
0
 def test_header(self):
     tra = ExportTra()
     tra.changeFormat('009')
     tra.setHeader('S5', 'CLI', 'JRL', num_dossier='B105ZZ')
     content = tra.render()
     assert position(content, 34, 3) == '009'
Example #28
0
 def test_header(self):
     tra = ExportTra()
     tra.changeFormat('009')
     tra.setHeader('S5', 'CLI', 'JRL', num_dossier='B105ZZ')
     content = tra.render()
     assert position(content, 34, 3) == '009'