You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.1KB

  1. # Copyright 2020 Tecnativa - Víctor Martínez
  2. # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
  3. from odoo.tests.common import SavepointCase
  4. class TestGithubConnectorCommon(SavepointCase):
  5. @classmethod
  6. def setUpClass(cls):
  7. super().setUpClass()
  8. cls.info_keys = [
  9. "code_count",
  10. "documentation_count",
  11. "empty_count",
  12. "string_count",
  13. "scanned_files",
  14. ]
  15. cls.model_gos = cls.env["github.organization.serie"]
  16. cls.model_gr = cls.env["github.repository"]
  17. cls.model_grb = cls.env["github.repository.branch"]
  18. cls.oca = cls.env.ref("github_connector.oca_organization")
  19. cls.serie_13 = cls.env.ref("github_connector.oca_organization_serie_13")
  20. cls.repository_ocb = cls.model_gr.create(
  21. {
  22. "name": "OCB",
  23. "organization_id": cls.oca.id,
  24. "github_login": "%s/OCB" % cls.oca.github_login,
  25. }
  26. )
  27. cls.repository_interface_github = cls.model_gr.create(
  28. {
  29. "name": "interface-github",
  30. "organization_id": cls.oca.id,
  31. "github_login": "%s/interface-github" % cls.oca.github_login,
  32. }
  33. )
  34. # repository branch
  35. cls.repository_ocb_13 = cls.model_grb.create(
  36. {
  37. "name": cls.serie_13.name,
  38. "organization_id": cls.oca.id,
  39. "repository_id": cls.repository_ocb.id,
  40. "organization_serie_id": cls.serie_13.id,
  41. }
  42. )
  43. cls.repository_interface_github_13 = cls.model_grb.create(
  44. {
  45. "name": cls.serie_13.name,
  46. "organization_id": cls.oca.id,
  47. "repository_id": cls.repository_interface_github.id,
  48. "organization_serie_id": cls.serie_13.id,
  49. }
  50. )
  51. cls._download_and_analyze(cls, cls.repository_interface_github_13)
  52. def _download_and_analyze(self, repo_branch):
  53. if repo_branch.state == "to_download":
  54. repo_branch._download_code()
  55. repo_branch.analyze_code_one()
上海开阖软件有限公司 沪ICP备12045867号-1