conftest.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import pytest
  2. from ..models import MenuLink
  3. from ..menu_links import get_footer_menu_links, get_top_menu_links
  4. @pytest.fixture
  5. def menu_link_top(db):
  6. return MenuLink.objects.create(
  7. link="https://top_menu_link.com",
  8. title="Top Menu Link",
  9. position=MenuLink.POSITION_TOP,
  10. )
  11. @pytest.fixture
  12. def menu_link_footer(db):
  13. return MenuLink.objects.create(
  14. link="https://footer_menu_link.com",
  15. title="Footer Menu Link",
  16. position=MenuLink.POSITION_FOOTER,
  17. )
  18. @pytest.fixture
  19. def menu_link_both(db):
  20. return MenuLink.objects.create(
  21. link="https://both_positions_menu_link.com",
  22. title="Both Positions Menu Link",
  23. position=MenuLink.POSITION_BOTH,
  24. )
  25. @pytest.fixture
  26. def menu_link_with_attributes(db):
  27. return MenuLink.objects.create(
  28. link="https://menu_link_with_attributes.com",
  29. title="Menu link with attributes",
  30. position=MenuLink.POSITION_BOTH,
  31. rel="noopener nofollow",
  32. target="_blank",
  33. css_class="test-link-css-class",
  34. )
  35. @pytest.fixture
  36. def links_footer(
  37. db, cache_versions, menu_link_footer, menu_link_both, menu_link_with_attributes
  38. ):
  39. return get_footer_menu_links(cache_versions)
  40. @pytest.fixture
  41. def links_top(
  42. db, cache_versions, menu_link_top, menu_link_both, menu_link_with_attributes
  43. ):
  44. return get_top_menu_links(cache_versions)