Exemplo n.º 1
0
        def test():
            append_req = AppendInventoryReq(name='Testdata_Append1',
                                            type_id=1,
                                            file_system_id=1,
                                            file_path='/mnt/xxx/append1',
                                            description='追加→削除データ',
                                            formats=['csv', 'zip'],
                                            schema='http://sample.com/datafotmat/testdata2')
            req = PutInventoryReq(name='Testdata99',
                                  type_id=1,
                                  file_system_id=1,
                                  file_path='/mnt/xxx/99',
                                  description='テスト99用のデータ',
                                  formats=['csv', 'zip'],
                                  schema='http://sample.com/datafotmat/testdata2')
            with app.app_context():
                InventoryService().append_inventory(organizer_id='dep-a',
                                                    ml_component_id=1,
                                                    req=append_req)

                response = InventoryService().get_inventories(organizer_id='dep-a', ml_component_id=1)
                append_inv = response.inventories[-1]

                InventoryService().delete_inventory(organizer_id='dep-a', ml_component_id=1,
                                                    inventory_id=append_inv.id_)

                try:
                    InventoryService().put_inventory(organizer_id='dep-a',
                                                     ml_component_id=1,
                                                     inventory_id=append_inv.id_,  # delete inventory_id
                                                     req=req)
                    it.fail()
                except QAIException as e:
                    it.assertTrue(type(e) is QAINotFoundException)
                    it.assertEqual(e.result_code, 'I34001')
Exemplo n.º 2
0
 def test():
     req = PutInventoryReq(name='Testdata99',
                           type_id=1,
                           file_system_id=1,
                           file_path='/mnt/xxx/99',
                           description='テスト99用のデータ',
                           formats=['csv', 'zip'],
                           schema='http://sample.com/datafotmat/testdata2')
     with app.app_context():
         response = InventoryService().put_inventory(organizer_id='dep-a', ml_component_id=1, inventory_id=1,
                                                     req=req)
         it.assertEqual(response.result.code, 'I32000')
Exemplo n.º 3
0
 def test():
     req = PutInventoryReq(name='Testdata99',
                           type_id=1,
                           file_system_id=999,
                           file_path='/aaa',
                           description='テスト99用のデータ',
                           formats=['csv', 'zip'],
                           schema='http://sample.com/datafotmat/testdata2')
     with app.app_context():
         try:
             InventoryService().put_inventory(organizer_id='dep-a', ml_component_id=1,
                                              inventory_id=1,
                                              req=req)
             it.fail()
         except QAIException as e:
             it.assertTrue(type(e) is QAIInvalidRequestException)
             it.assertEqual(e.result_code, 'I34002')
Exemplo n.º 4
0
        def test():
            append_req = AppendInventoryReq(name='Testdata_Append1',
                                            type_id=1,
                                            file_system_id=1,
                                            file_path='/mnt/xxx/append1',
                                            description='追加→削除データ',
                                            formats=['csv', 'zip'],
                                            schema='http://sample.com/datafotmat/testdata2')
            edit_req = PutInventoryReq(name='Testdata99',
                                       type_id=1,
                                       file_system_id=1,
                                       file_path='/mnt/xxx/99',
                                       description='テスト99用のデータ',
                                       formats=['csv', 'zip', 'json'],
                                       schema='http://sample.com/datafotmat/testdata2-2')
            with app.app_context():
                InventoryService().append_inventory(organizer_id='dep-a',
                                                    ml_component_id=1,
                                                    req=append_req)

                response = InventoryService().get_inventories(organizer_id='dep-a', ml_component_id=1)
                append_inv = response.inventories[-1]

                InventoryService().put_inventory(organizer_id='dep-a',
                                                 ml_component_id=1,
                                                 inventory_id=append_inv.id_,
                                                 req=edit_req)

                response = InventoryService().get_inventories(organizer_id='dep-a', ml_component_id=1)
                edit_inv = response.inventories[-1]

                it.assertEqual(append_inv.id_, edit_inv.id_)
                it.assertEqual(append_inv.creation_datetime, edit_inv.creation_datetime)
                it.assertNotEqual(append_inv.update_datetime, edit_inv.update_datetime)
                it.assertEqual(edit_inv.file_path, edit_req.file_path)
                it.assertEqual(edit_inv.type.id_, edit_req.type_id)
                it.assertEqual(edit_inv.file_system.id_, edit_req.file_system_id)
                it.assertEqual(edit_inv.name, edit_req.name)
                it.assertEqual([f.format for f in edit_inv.formats], edit_req.formats)