Example #1
0
    def setUpClass(cls):
        app.testing = True
        cls.client = app.test_client()

        cls.admin_token = 'a2258791-5dee-4cf7-a84c-56f35bdf1bc7'
        cls.staff_token = 'f7462ade-e762-40d8-8bce-1dfa47ad1fff'
        cls.user_token1 = '762b3b20-e7e3-4590-ae5a-a2abee69f50e'
        cls.user_token2 = '48727317-ef03-4b4d-9f9b-23ecd74e6678'

        cls.user_df = pd.DataFrame(
            columns=['username', 'password', 'forename', 'surname', 'email', 'role', 'token'],
            data=[
                ['yiluzhu', '4a0c', 'Yilu', 'Zhu', '*****@*****.**', 'admin', cls.admin_token],
                ['alexzhu', 'c612', 'Alex', 'Zhu', '*****@*****.**', 'staff', cls.staff_token],
                ['tonyfoltz', '7e24', 'Tony', 'Foltz', '*****@*****.**', 'user', cls.user_token1],
                ['jeffreywood', '7e24', 'Jeffrey', 'Wood', '*****@*****.**', 'user', cls.user_token2],
            ]
        )

        cls.record_df = pd.DataFrame(
            columns=['username', 'date', 'lat', 'lon', 'distance', 'time', 'weather'],
            data=[
                ['tonyfoltz', '2020-09-21', 38.7, 46.2, 9369, 25, 'Clouds'],
                ['tonyfoltz', '2020-09-22', -8.3, 37.9, 3979, 13, 'Rain'],
                ['jeffreywood', '2020-09-21', -26.2, -82.0, 8251, 10, 'Clear'],
                ['tonyfoltz', '2020-09-23', 27.1, 19.9, 8743, 43, 'Clear'],
            ]
        )
        cls.params = {'rid': 2, 'username': '******', 'distance': 5000, 'time': 20}

        create_user_table_from_df(cls.user_df, cls.admin_token)
Example #2
0
    def setUpClass(cls):
        app.testing = True
        cls.client = app.test_client()

        cls.admin_token = 'a2258791-5dee-4cf7-a84c-56f35bdf1bc7'
        cls.staff_token = 'f7462ade-e762-40d8-8bce-1dfa47ad1fff'
        cls.user_token = '762b3b20-e7e3-4590-ae5a-a2abee69f50e'

        cls.user_df = pd.DataFrame(
            columns=[
                'username', 'password', 'forename', 'surname', 'email', 'role',
                'token'
            ],
            data=[
                [
                    'yiluzhu', '4a0c', 'Yilu', 'Zhu', '*****@*****.**',
                    'admin', cls.admin_token
                ],
                [
                    'alexzhu', 'c612', 'Alex', 'Zhu', '*****@*****.**',
                    'staff', cls.staff_token
                ],
                [
                    'tonyfoltz', '7e24', 'Tony', 'Foltz',
                    '*****@*****.**', 'user', cls.user_token
                ],
                [
                    'jeffreywood', '7e24', 'Jeffrey', 'Wood',
                    '*****@*****.**', 'user', ''
                ],
                [
                    'antoniasimcox', '7e24', 'Antonia', 'Simcox',
                    '*****@*****.**', 'user', ''
                ],
            ])
        cls.record_df = pd.DataFrame(
            columns=[
                'username', 'date', 'lat', 'lon', 'distance', 'time', 'weather'
            ],
            data=[
                ['tonyfoltz', '2020-09-23', 38.7, 46.2, 9369, 25, 'Clouds'],
                ['jeffreywood', '2020-09-21', -26.2, -82.0, 8251, 10, 'Clear'],
                ['jeffreywood', '2020-09-21', 37.8, -145.6, 7572, 7, 'Clouds'],
                ['tonyfoltz', '2020-09-22', -8.3, 37.9, 3979, 13, 'Clear'],
                ['jeffreywood', '2020-09-24', 51.0, -119.8, 5131, 29, 'Rain'],
                ['tonyfoltz', '2020-09-23', 27.1, 19.9, 8743, 43, 'Clear'],
                ['jeffreywood', '2020-09-24', 13.3, 32.9, 6581, 13, 'Clouds'],
                ['tonyfoltz', '2020-09-22', 19.3, 144.2, 4951, 45, 'Clouds'],
                [
                    'jeffreywood', '2020-09-25', -46.3, -24.4, 5337, 50,
                    'Clouds'
                ],
                ['jeffreywood', '2020-09-25', 46.5, -177.4, 3223, 39, 'Rain'],
            ])

        create_user_table_from_df(cls.user_df, cls.admin_token)
        create_record_table_from_df(cls.record_df, cls.admin_token)
Example #3
0
    def setUpClass(cls):
        app.testing = True
        cls.client = app.test_client()

        cls.admin_token = 'a2258791-5dee-4cf7-a84c-56f35bdf1bc7'
        cls.staff_token = 'f7462ade-e762-40d8-8bce-1dfa47ad1fff'
        cls.user_token = '762b3b20-e7e3-4590-ae5a-a2abee69f50e'

        cls.user_df = pd.DataFrame(columns=[
            'username', 'password', 'forename', 'surname', 'email', 'role',
            'token'
        ],
                                   data=[
                                       [
                                           'yiluzhu', '4a0c', 'Yilu', 'Zhu',
                                           '*****@*****.**', 'admin',
                                           cls.admin_token
                                       ],
                                       [
                                           'alexzhu', 'c612', 'Alex', 'Zhu',
                                           '*****@*****.**', 'staff',
                                           cls.staff_token
                                       ],
                                       [
                                           'tonyfoltz', '7e24', 'Tony',
                                           'Foltz', '*****@*****.**',
                                           'user', cls.user_token
                                       ],
                                   ])
        cls.yesterday = date.today() - timedelta(days=1)
        cls.params = {
            'username': '******',
            'date': str(cls.yesterday),
            'lat': 38.7,
            'lon': 46.2,
            'distance': 9000,
            'time': 25
        }

        create_user_table_from_df(cls.user_df, cls.admin_token)
Example #4
0
    def setUpClass(cls):
        app.testing = True
        cls.client = app.test_client()

        cls.admin_token = 'a2258791-5dee-4cf7-a84c-56f35bdf1bc7'
        cls.staff_token = 'f7462ade-e762-40d8-8bce-1dfa47ad1fff'
        cls.user_token = '762b3b20-e7e3-4590-ae5a-a2abee69f50e'

        cls.user_df = pd.DataFrame(
            columns=[
                'username', 'password', 'forename', 'surname', 'email', 'role',
                'token'
            ],
            data=[
                [
                    'yiluzhu', '4a0c', 'Yilu', 'Zhu', '*****@*****.**',
                    'admin', cls.admin_token
                ],
                [
                    'alexzhu', 'c612', 'Alex', 'Zhu', '*****@*****.**',
                    'staff', cls.staff_token
                ],
                [
                    'tonyfoltz', '7e24', 'Tony', 'Foltz',
                    '*****@*****.**', 'user', cls.user_token
                ],
                [
                    'jeffreywood', '7e24', 'Jeffrey', 'Wood',
                    '*****@*****.**', 'user', ''
                ],
                [
                    'antoniasimcox', '7e24', 'Antonia', 'Simcox',
                    '*****@*****.**', 'user', ''
                ],
            ])

        create_user_table_from_df(cls.user_df, cls.admin_token)
Example #5
0
 def setUp(self):
     create_user_table_from_df(self.user_df, self.admin_token)