def test_query_user_ids_distribution(self):
        self.setUp()
        args = query_user_id_distribution.parse_args(['-i', os.path.dirname(os.path.abspath(__file__))+'/../test/test_user_ids.json', '-o', os.path.dirname(os.path.abspath(__file__))+'/../test/output.csv'])
        query_user_id_distribution.query_distribution(args.output, args.input)

        with open(os.path.dirname(os.path.abspath(__file__))+'/../test/test_user_ids.json') as f:
            original_total_count = sum(1 for _ in f)

        with open(os.path.dirname(os.path.abspath(__file__))+'/../test/output.csv') as f:
            reader = csv.DictReader(f)
            for row in reader:
                if row['id'] == 'all_users_total':
                    new_total_count = int(row['smapp_tweet_count'])
        self.assertEqual(original_total_count,new_total_count)
        self.tearDown()
Ejemplo n.º 2
0
    def test_query_user_ids_distribution(self):
        self.setUp()
        args = query_user_id_distribution.parse_args([
            '-i',
            os.path.dirname(os.path.abspath(__file__)) +
            '/../test/test_user_ids.json', '-o',
            os.path.dirname(os.path.abspath(__file__)) + '/../test/output.csv'
        ])
        query_user_id_distribution.query_distribution(args.output, args.input)

        with open(
                os.path.dirname(os.path.abspath(__file__)) +
                '/../test/test_user_ids.json') as f:
            original_total_count = sum(1 for _ in f)

        with open(
                os.path.dirname(os.path.abspath(__file__)) +
                '/../test/output.csv') as f:
            reader = csv.DictReader(f)
            for row in reader:
                if row['id'] == 'all_users_total':
                    new_total_count = int(row['smapp_tweet_count'])
        self.assertEqual(original_total_count, new_total_count)
        self.tearDown()
 def test_merge_json_parse_args(self):
     args = query_user_id_distribution.parse_args(['-i', '~/data1.json', '-o', '~/data3.json'])
     self.assertEqual(args.input,'~/data1.json')
     self.assertEqual(args.output,'~/data3.json')
Ejemplo n.º 4
0
 def test_merge_json_parse_args(self):
     args = query_user_id_distribution.parse_args(
         ['-i', '~/data1.json', '-o', '~/data3.json'])
     self.assertEqual(args.input, '~/data1.json')
     self.assertEqual(args.output, '~/data3.json')