• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ProteinsWebTeam / interpro7-api / 1

18 Jun 2024 09:19AM UTC coverage: 25.541% (-68.5%) from 94.023%
1

push

github

web-flow
Merge pull request #147 from ProteinsWebTeam/set-sortable

sort by in sets

1 of 2 new or added lines in 1 file covered. (50.0%)

6742 existing lines in 50 files now uncovered.

2559 of 10019 relevant lines covered (25.54%)

0.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

51.61
/functional_tests/base.py
1
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
2✔
2
from django.test import override_settings
2✔
3
from selenium import webdriver
2✔
4
from selenium.webdriver.common.by import By
2✔
5
import sys
2✔
6
import time
2✔
7
import os
2✔
8
from selenium.common.exceptions import StaleElementReferenceException
2✔
9
from selenium.webdriver.chrome.options import Options
2✔
10

11
from webfront.tests.fixtures_reader import FixtureReader
2✔
12
from interpro.settings import SEARCHER_TEST_URL, SEARCHER_TEST_PASSWORD
2✔
13

14

15
@override_settings(SEARCHER_URL=SEARCHER_TEST_URL)
2✔
16
@override_settings(SEARCHER_PASSWORD=SEARCHER_TEST_PASSWORD)
2✔
17
@override_settings(SEARCHER_INDEX="test")
2✔
18
class FunctionalTest(StaticLiveServerTestCase):
2✔
19
    fixtures = [
2✔
20
        "webfront/tests/fixtures_entry.json",
21
        "webfront/tests/fixtures_protein.json",
22
        "webfront/tests/fixtures_structure.json",
23
        "webfront/tests/fixtures_organisms.json",
24
        "webfront/tests/fixtures_set.json",
25
        "webfront/tests/fixtures_database.json",
26
    ]
27
    links_fixtures = "webfront/tests/relationship_features.json"
2✔
28

29
    @classmethod
2✔
30
    def setUpClass(cls):
2✔
31
        for arg in sys.argv:
2✔
32
            if "liveserver" in arg:
2✔
33
                cls.server_url = "http://" + arg.split("=")[1]
×
34
                return
×
35
        super().setUpClass()
2✔
36
        cls.server_url = cls.live_server_url
2✔
37
        cls.fr = FixtureReader(cls.fixtures + [cls.links_fixtures])
2✔
38
        docs = cls.fr.get_fixtures()
2✔
39
        cls.fr.add_to_search_engine(docs)
2✔
40

41
    @classmethod
2✔
42
    def tearDownClass(cls):
2✔
43
        # cls.fr.clear_search_engine()
UNCOV
44
        if cls.server_url == cls.live_server_url:
×
UNCOV
45
            super().tearDownClass()
×
46

47
    def setUp(self):
2✔
UNCOV
48
        try:
×
UNCOV
49
            if os.environ["BROWSER_TEST"] == "chrome":
×
UNCOV
50
                chrome_options = Options()
×
UNCOV
51
                chrome_options.add_argument("--headless")
×
52

UNCOV
53
                if "BROWSER_TEST_PATH" in os.environ:
×
54
                    self.browser = webdriver.Chrome(
×
55
                        executable_path=os.environ["BROWSER_TEST_PATH"],
56
                        chrome_options=chrome_options,
57
                    )
58
                else:
UNCOV
59
                    self.browser = webdriver.Chrome(chrome_options=chrome_options)
×
60
            else:
61
                raise KeyError
×
62
        except KeyError:
×
63
            self.browser = webdriver.Firefox()
×
UNCOV
64
        self.browser.implicitly_wait(3)
×
65

66
    def tearDown(self):
2✔
UNCOV
67
        self.browser.quit()
×
68

69
    def click_link_and_wait(self, link):
2✔
UNCOV
70
        link.click()
×
71

UNCOV
72
        def link_has_gone_stale():
×
UNCOV
73
            try:
×
74
                # poll the link with an arbitrary call
UNCOV
75
                link.find_elements(By.ID, "doesnt-matter")
×
76
                return False
×
UNCOV
77
            except StaleElementReferenceException:
×
UNCOV
78
                return True
×
79

UNCOV
80
        self.wait_for(link_has_gone_stale)
×
81

82
    def wait_for(self, condition_function):
2✔
UNCOV
83
        start_time = time.time()
×
UNCOV
84
        while time.time() < start_time + 3:
×
UNCOV
85
            if condition_function():
×
UNCOV
86
                return True
×
87
            else:
88
                time.sleep(0.1)
×
89
        raise Exception("Timeout waiting for {}".format(condition_function.__name__))
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc