Exemple #1
0
 def test_raise_exception_wrong_type_arg(self):
     with self.assertRaises(TypeError,
                            msg='Integer is not valid file name'):
         path_finder.get_abs_path(1)
     with self.assertRaises(TypeError,
                            msg='Collection is not valid file name'):
         path_finder.get_abs_path([1, 2])
Exemple #2
0
    def setUpClass(cls):
        super(ParcelDomainTestCase, cls).setUpClass()

        cls.base_test_case = {
            'parcel_type': 'medium_box',
            'storage': '5782c996-d0d0-4e4f-895e-e4a98f26c65f',
            'date': ['2019-04-22', '2019-04-10']
        }

        cls.test_parcel = {
            "id": "720745e2-cee6-4338-8399-72b6affb71a6",
            "description": "Food",
            "type_id": "ac13d5ee-61ba-4945-b5e8-a84d8da5a885",
            "weight": 17.3,
            "cost": 381.6,
            "supply_id": "7542e12a-c30b-4e68-9b22-42dbc477cb5a"
        }
        cls.new_parcel = {
            "id": "720745e2-cee6-4338-8399-72b6affb71a6",
            "description": "Food",
            "type_id": "ac13d5ee-61ba-4945-b5e8-a84d8da5a885",
            "weight": 20,
            "cost": 381.6,
            "supply_id": "dcf19a78-b01f-4251-924f-3403df3afdaf"
        }
        cls.good_id = '720745e2-cee6-4338-8399-72b6affb71a6'
        cls.bad_id = '49732169'
        cls.id_not_exist = '42732169-9b7b-4f09-aa1b-7fecb350ab14'
        cls.data = JsonLoader(get_abs_path('parcel.json'))

        cls.ctx = Context(prec=5)
        cls.types = [
            uuid.UUID, str, uuid.UUID, cls.ctx.create_decimal_from_float,
            cls.ctx.create_decimal_from_float, uuid.UUID
        ]

        cls.my_loop = asyncio.get_event_loop()
        cls.my_loop.run_until_complete(
            load_json_data(
                get_dict_gen([
                    get_abs_path(f) for f in [
                        'parceltype.json', 'clients.json', 'storage.json',
                        'supply.json'
                    ]
                ])))
Exemple #3
0
    def setUpClass(cls):
        super(ParselTypeDomainTestCase, cls).setUpClass()

        cls.test_type = {
            "id": "78f6f9ca-2771-406e-a926-db8c5006c605",
            "type_name": "documents"
        }
        cls.new_type = {
            "id": "78f6f9ca-2771-406e-a926-db8c5006c605",
            "type_name": "very important documents"
        }
        cls.good_id = '78f6f9ca-2771-406e-a926-db8c5006c605'
        cls.bad_id = '49732169'
        cls.id_not_exist = '42732169-9b7b-4f09-aa1b-7fecb350ab14'
        cls.data = JsonLoader(get_abs_path('parceltype.json'))
Exemple #4
0
    def setUpClass(cls):
        super(StorageDomainTestCase, cls).setUpClass()

        cls.test_storage = {
            "id": "0148bc1a-90c7-451b-aecc-7081e0f4b60a",
            "address": "197D Klochkovska str.",
            "max_weight": 1000,
            "max_capacity": 30000
        }
        cls.new_storage = {
            "id": "0148bc1a-90c7-451b-aecc-7081e0f4b60a",
            "address": "222 Valentynivska str., apt. 39",
            "max_weight": 100,
            "max_capacity": 20000
        }
        cls.good_id = '0148bc1a-90c7-451b-aecc-7081e0f4b60a'
        cls.bad_id = '49732169'
        cls.id_not_exist = '42732169-9b7b-4f09-aa1b-7fecb350ab14'
        cls.data = JsonLoader(get_abs_path('storage.json'))
Exemple #5
0
    def setUpClass(cls):
        super(ClientDomainTestCase, cls).setUpClass()

        cls.client = [{
            "id": "dcf19a78-b01f-4251-924f-3403df3afdaa",
            "name": "John",
            "email": "*****@*****.**",
            "age": 18,
            "address": "3073 Derek Drive"
        }]
        cls.new_client = [{
            "id": "dcf19a78-b01f-4251-924f-3403df3afdaa",
            "name": "John Galt",
            "email": "*****@*****.**",
            "age": 38,
            "address": "3073 Derek Drive avenue"
        }]
        cls.good_id = 'dcf19a78-b01f-4251-924f-3403df3afdaa'
        cls.bad_id = '49732169'
        cls.id_not_exist = '42732169-9b7b-4f09-aa1b-7fecb350ab14'
        cls.data = JsonLoader(get_abs_path('clients.json'))
Exemple #6
0
def get_file_list(parsed_args):
    if parsed_args.all:
        file_list = [get_abs_path(f) for f in os.listdir(get_abs_path())]
    else:
        file_list = [get_abs_path(f) for f in parsed_args.table]
    return file_list
Exemple #7
0
 def test_wrong_path(self):
     test_path = path_finder.get_abs_path('clients')
     self.assertNotEqual(test_path, self.correct_path)
Exemple #8
0
 def test_find_correct_path_file_name_empty(self):
     test_path = path_finder.get_abs_path()
     self.assertEqual(test_path, self.correct_path_no_file)
Exemple #9
0
 def test_find_correct_path_file_name_not_empty(self):
     test_path = path_finder.get_abs_path('clients.json')
     self.assertEqual(test_path, self.correct_path)