Exemplo n.º 1
0
    def setUp(self):
        global ADMIN_INIT
        global BUILDING_INIT

        global NTHV, THHN, HTKV
        admin_test = copy.deepcopy(user_init)
        ADMIN_INIT = UserService.save(admin_test)
        building_test = building_init
        building_test['user_id'] = ADMIN_INIT.id
        BUILDING_INIT = Building.objects.create(**building_test)

        # Add visitor
        vistor1['building_id'] = BUILDING_INIT.id
        NTHV = Visitor.objects.create(**vistor1)
        vistor2['building_id'] = BUILDING_INIT.id
        THHN = Visitor.objects.create(**vistor2)
        vistor3['building_id'] = BUILDING_INIT.id
        HTKV = Visitor.objects.create(**vistor3)
Exemplo n.º 2
0
    def setUp(self):
        global ADMIN_INIT
        global BUILDING_INIT
        global TOKEN
        global VISITOR_1, VISITOR_2

        admin_test = copy.deepcopy(user_init)
        ADMIN_INIT = UserService.save(admin_test)
        building_test = building_init
        building_test['user_id'] = ADMIN_INIT.id
        BUILDING_INIT = Building.objects.create(**building_test)

        VISITOR_1 = Visitor.objects.create(**visitor_1)
        VISITOR_2 = Visitor.objects.create(**visitor_2)

        # login
        url = '/api/v1/auth'
        data = {'email': '*****@*****.**', 'password': '******'}
        response = self.client.post(url, data, **head)
        TOKEN = response.data['token']
Exemplo n.º 3
0
    def setUp(self):
        global ADMIN_INIT
        global BUILDING_INIT
        global TOKEN

        admin_test = copy.deepcopy(user_init)
        ADMIN_INIT = UserService.save(admin_test)
        building_test = building_init
        building_test['user_id'] = ADMIN_INIT.id
        BUILDING_INIT = Building.objects.create(**building_test)
        badge_type_1['building_id'] = BUILDING_INIT.id
        badge_type_2['building_id'] = BUILDING_INIT.id
        BadgeType.objects.create(**badge_type_1)
        BadgeType.objects.create(**badge_type_2)

        # login
        url = '/api/v1/auth'
        data = {'email': '*****@*****.**', 'password': '******'}
        response = self.client.post(url, data, **head)
        TOKEN = response.data['token']
Exemplo n.º 4
0
    def setUp(self):
        """
        data file:
            "checkin", "visitor_code", "location_id", "badge_id", "date", "time", "destination", "badge_type_id", "name", "id_card", "avatar", "dob"
            1,122199203165225,122,1,2017-03-28,08:30:53,Grade 1 - 101,1,THN,241225225,cmnd/1.jpg,1992-03-16
            1,122199203175224,122,2,2017-03-29,08:30:53,Grade 2 - 102,1,TA,241225224,cmnd/2.jpg,1992-03-17
            1,122199203185223,122,3,2017-04-29,08:30:53,Grade 3 - 103,2,NTHV,241225223,cmnd/3.jpg,1992-03-18
            1,122199203195222,122,4,2017-03-29,08:30:53,Grade 4 - 104,2,TG,241225222,cmnd/4.jpg,1992-03-19
            0,122199203165225,2017-03-29,09:30:53
            0,122199203185223,2017-04-29,09:40:53
        """
        global ADMIN_INIT
        global BUILDING_INIT
        global TOKEN

        admin_test = copy.deepcopy(user_init)
        ADMIN_INIT = UserService.save(admin_test)
        building_test = building_init
        building_test['user_id'] = ADMIN_INIT.id
        BUILDING_INIT = Building.objects.create(**building_test)

        # login
        url = '/api/v1/auth'
        data = {
            'email': '*****@*****.**',
            'password': '******'
        }
        response = self.client.post(url, data, **head)
        TOKEN = response.data['token']

        badge_type_1['building_id'] = BUILDING_INIT.id
        badge_type_2['building_id'] = BUILDING_INIT.id
        BadgeType.objects.create(**badge_type_1)
        BadgeType.objects.create(**badge_type_2)
        input = {}
        input['data'] = 'test/data.csv'
        input['upload_dir'] = 'test/upload'

        act_rs = BadgeService.sync(input, building=BUILDING_INIT.id)
Exemplo n.º 5
0
    def setUp(self):
        global ADMIN_INIT
        global BUILDING_INIT

        admin_test = copy.deepcopy(user_init)
        ADMIN_INIT = UserService.save(admin_test)