コード例 #1
0
ファイル: naming_test.py プロジェクト: rajubuddha/TACTIC
    def _test_checkin_type(my):
        my.assertEquals(my.auto_snapshot.get_version(), 2)
        dir_name = my.auto_snapshot.get_file_name_by_type('main')
        my.assertEquals(dir_name , 'naming_test_folder_naming_base_test_v002')
        
        dir_name = my.auto_snapshot2.get_file_name_by_type('main')

        my.assertEquals(1, my.auto_snapshot2.get_version())
        my.assertEquals(dir_name , '.tactic_test_naming_folder_test_v001')

        dir_name = my.auto_snapshot3.get_file_name_by_type('main')
        # this takes the auto generated name
        my.assertEquals(dir_name , 'naming_test_folder3_naming_base_test_v003')


        # this one would take into account of the new naming entry introduced in _test_get_naming
        # test a blank checkin_type
        dir_path4 = "./naming_test_folder4"
        checkin = FileCheckin(my.person, dir_path4, "main", context='naming_base_test', snapshot_type='directory', checkin_type='', mode='copy')
        checkin.execute()
        my.auto_snapshot4 = checkin.get_snapshot()
        dir_name = my.auto_snapshot4.get_file_name_by_type('main')
        lib_dir = my.auto_snapshot4.get_dir('relative')
        my.assertEquals(dir_name , 'generic_phil_v004')
        my.assertEquals(lib_dir , 'unittest/cut/generic/phil')
        snapshot_xml = my.auto_snapshot4.get_xml_value('snapshot')
        checkin_type = snapshot_xml.get_nodes_attr('/snapshot','checkin_type')
        # un-specified checkin_type with a matching naming will default to "strict"
        my.assertEquals('strict', checkin_type[0])

        # this should pick the auto checkin_type naming convention with the _OO at the end of context
        checkin = FileCheckin(my.person, dir_path4, "main", context='naming_base_test_OO', snapshot_type='directory', checkin_type='', mode='copy')
        checkin.execute()
        my.auto_snapshot4 = checkin.get_snapshot()
        dir_name = my.auto_snapshot4.get_file_name_by_type('main')
        lib_dir = my.auto_snapshot4.get_dir('relative')
        my.assertEquals(dir_name , 'generic_phil_v001')
        my.assertEquals(lib_dir , 'unittest/cut/generic/phil')
        snapshot_xml = my.auto_snapshot4.get_xml_value('snapshot')
        checkin_type = snapshot_xml.get_nodes_attr('/snapshot','checkin_type')
        # un-specified checkin_type with a matching naming will default to "strict"
        my.assertEquals('auto', checkin_type[0])


        dir_path4 = "./naming_test_folder4"
        checkin = FileCheckin(my.person, dir_path4, "main", context='naming_base_test', snapshot_type='directory', checkin_type='auto')
        checkin.execute()
        my.auto_snapshot5 = checkin.get_snapshot()
        snapshot_xml = my.auto_snapshot5.get_xml_value('snapshot')
        checkin_type = snapshot_xml.get_nodes_attr('/snapshot','checkin_type')
        
        dir_name = my.auto_snapshot5.get_file_name_by_type('main')
        lib_dir = my.auto_snapshot5.get_dir('relative')
        my.assertEquals(dir_name , 'generic_phil_v005')
        my.assertEquals(lib_dir , 'unittest/cut/generic/phil')
        my.assertEquals('auto', checkin_type[0])

        versionless = Snapshot.get_versionless(my.auto_snapshot5.get_value('search_type'), my.auto_snapshot5.get_value('search_id'), 'naming_base_test', mode='latest', create=False)

        dir_name = versionless.get_file_name_by_type('main')
        lib_dir = versionless.get_dir('relative')
        my.assertEquals(dir_name , 'generic_phil')
        my.assertEquals(lib_dir , 'unittest/cut/generic/phil')
        path = versionless.get_lib_path_by_type()