Esempio n. 1
0
def get_category_urls_fake_data(url):
    detail_urls = technews_parser.get_category_urls(url)
    appending_dict = {
        url: detail_urls
    }
    targetfile_read = open(the_path_of_this_file + '/pickle/get_category_urls/fake_data_pickle', 'r')
    get_category_urls_target= pickle.load(targetfile_read)

    temp_dict = get_category_urls_target.copy()
    appending_dict.update(temp_dict)

    targetfile = open(the_path_of_this_file + '/pickle/get_category_urls/fake_data_pickle', 'wb')
    pickle.dump(appending_dict, targetfile)
    targetfile.close()
    print('get_category_urls_fake_data is done')
Esempio n. 2
0
def get_category_urls_fake_data(url):
    detail_urls = technews_parser.get_category_urls(url)
    appending_dict = {url: detail_urls}
    targetfile_read = open(
        the_path_of_this_file + '/pickle/get_category_urls/fake_data_pickle',
        'r')
    get_category_urls_target = pickle.load(targetfile_read)

    temp_dict = get_category_urls_target.copy()
    appending_dict.update(temp_dict)

    targetfile = open(
        the_path_of_this_file + '/pickle/get_category_urls/fake_data_pickle',
        'wb')
    pickle.dump(appending_dict, targetfile)
    targetfile.close()
    print('get_category_urls_fake_data is done')
Esempio n. 3
0
 def test_get_category_urls(self):
     with patch.object(requests, 'get', side_effect=get_fake_request_get_categry_urls) as requests.get:
         url = get_test_urls_get_category_urls(1)
         result = technews_parser.get_category_urls(url)
         target = get_fake_data_get_category_urls(url)
         self.assertEqual(result, target)