Advertisement
Aimanan

Untitled

Apr 5th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. Manual Scrape Service testing:
  2. 1. Create a new file
  3. 2. Config the account, the proxy and the Service
  4. example: (import the missing files)
  5. username = AccountConstants.USERNAME_1
  6. password = AccountConstants.PASSWORD_1
  7. proxy = AccountConstants.PROXY_HOST
  8. config = AccountConfig.AccountConfig(username, password, proxy)
  9. api_util = ApiUtil(config)
  10. scrape_service = ScrapeService(api_util)
  11. csv_service = CSVService()
  12.  
  13. 3. Choose a method form the service and call it
  14.  
  15. scrape_service.get_tag_info("athleticwear")
  16. scrape_service.get_tag_info("fitnessfashion")
  17. scrape_service.get_tag_info("mytag")...
  18.  
  19.  
  20. 4.Print the data objects received from the cache
  21.  
  22. for tag in scrape_service._cache_hashtags:
  23. print(scrape_service._cache_hashtags)
  24. pprint(vars(scrape_service._cache_hashtags[tag]))
  25. print("---------------------")
  26.  
  27.  
  28.  
  29. Simple example:
  30. from pprint import pprint
  31.  
  32. from services.CSVService import CSVService
  33.  
  34. from services.ScrapeService import ScrapeService
  35. from services.utils import AccountConfig, AccountConstants
  36. from services.utils.ApiUtil import ApiUtil
  37.  
  38. username = AccountConstants.USERNAME_1
  39. password = AccountConstants.PASSWORD_1
  40. proxy = AccountConstants.PROXY_HOST
  41. config = AccountConfig.AccountConfig(username, password, proxy)
  42. api_util = ApiUtil(config)
  43. scrape_service = ScrapeService(api_util)
  44. csv_service = CSVService()
  45.  
  46. scrape_service.get_tag_info("athleticwear")
  47. scrape_service.get_tag_info("fitnessfashion")
  48.  
  49. for tag in scrape_service._cache_hashtags:
  50. print(scrape_service._cache_hashtags)
  51. pprint(vars(scrape_service._cache_hashtags[tag]))
  52.  
  53.  
  54. The code is well covered with integration tests and works well, so there is no real need of manual testing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement