Example #1
0
    def test_mysql_serialize(self) -> None:
        col_readers = [ColumnReader(database='db', cluster='gold', schema='scm', table='foo', column='*',
                                    user_email='*****@*****.**')]
        table_col_usage = TableColumnUsage(col_readers=col_readers)

        actual = []
        record = table_col_usage.next_record()
        while record:
            actual.append(mysql_serializer.serialize_record(record))
            record = table_col_usage.next_record()

        expected_user = {'rk': '*****@*****.**',
                         'first_name': '',
                         'last_name': '',
                         'full_name': '',
                         'employee_type': '',
                         'is_active': True,
                         'updated_at': 0,
                         'slack_id': '',
                         'github_username': '',
                         'team_name': '',
                         'email': '*****@*****.**',
                         'role_name': ''}
        expected_usage = {'table_rk': 'db://gold.scm/foo',
                          'user_rk': '*****@*****.**',
                          'read_count': 1}
        expected = [expected_user, expected_usage]

        self.assertEqual(expected, actual)
Example #2
0
    def test_mysql_serialize(self) -> None:
        col_readers = [
            ColumnReader(database='db',
                         cluster='gold',
                         schema='scm',
                         table='foo',
                         column='*',
                         user_email='*****@*****.**')
        ]
        table_col_usage = TableColumnUsage(col_readers=col_readers)

        actual = []
        record = table_col_usage.next_record()
        while record:
            actual.append(mysql_serializer.serialize_record(record))
            record = table_col_usage.next_record()

        expected_user = {'rk': '*****@*****.**', 'email': '*****@*****.**'}
        expected_usage = {
            'table_rk': 'db://gold.scm/foo',
            'user_rk': '*****@*****.**',
            'read_count': 1
        }
        expected = [expected_user, expected_usage]

        self.assertEqual(expected, actual)