How to use regions - 10 common examples

To help you get started, we’ve selected a few regions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sneakypete81 / updatescanner / test / functional / test_sidebar.py View on Github external
def test_clicking_an_item_opens_it(self):
        sidebar.updatescanner_website_item.click()

        assert_that(
            content.updatescanner_website_page, is_(eventually_visible()))
github localwiki / localwiki-backend-server / localwiki / regions / tests.py View on Github external
def setUp(self):
        self.regions = []

        self.sf = Region(full_name="San Francisco", slug="sf")
        self.sf.save()
        self.oak = Region(full_name="Oakland", slug="oak")
        self.oak.save()

        self.philip = User(username="Philip", email="philip@example.org")
        self.philip.save()

        self.marina = User(username="Marina", email="marina@example.org")
        self.marina.save()

        # Philip admin of SF
        self.sf.regionsettings.admins.add(self.philip)

        # Marina admin of Oakland
        self.oak.regionsettings.admins.add(self.marina)
github localwiki / localwiki-backend-server / localwiki / regions / tests.py View on Github external
def setUp(self):
        self.regions = []

        self.sf = Region(full_name="San Francisco", slug="sf")
        self.sf.save()
        self.oak = Region(full_name="Oakland", slug="oak")
        self.oak.save()
github sneakypete81 / updatescanner / test / functional / test_popup.py View on Github external
def add_test_website(firefox):
    sidebar.updatescanner_website_item.click()
    assert_that(content.updatescanner_website_page, is_(eventually_visible()))
    debug.navigate_from_current(firefox)
    debug.add_page.click()
github sneakypete81 / updatescanner / test / functional / test_page_view.py View on Github external
def test_page_settings_can_adjust_parameters(self):
        sidebar.updatescanner_website_item.click()
        page_view.settings_button.click()
        page_view.page_settings_menu_item.click()

        page_settings.autoscan_often.click()
        left_ten_times()
        page_settings.change_threshold_low.click()
        left_ten_times()

        page_settings.ok_button.click()

        page_view.settings_button.click()
        page_view.debug_info_menu_item.click()

        assert_that(debug_info.title, is_(eventually_visible()))
        assert_that(debug_info.scan_rate_minutes_5, is_(visible()))
        assert_that(debug_info.change_threshold_0, is_(visible()))
github sneakypete81 / updatescanner / test / functional / test_page_view.py View on Github external
def test_page_settings_can_be_opened(self):
        sidebar.updatescanner_website_item.click()
        page_view.settings_button.click()
        page_view.page_settings_menu_item.click()

        assert_that(page_settings.updatescanner_website, is_(eventually_visible()))
github sneakypete81 / updatescanner / test / functional / test_page_view.py View on Github external
def test_clicking_title_loads_source_website(self, firefox):
        sidebar.updatescanner_website_item.click()
        page_view.updatescanner_title.click()

        wait_until(
            firefox.get_current_url,
            equals="https://sneakypete81.github.io/updatescanner/",
            timeout_seconds=30,
        )
github sneakypete81 / updatescanner / test / functional / test_page_view.py View on Github external
def test_debug_info_can_be_opened(self):
        sidebar.updatescanner_website_item.click()
        page_view.settings_button.click()
        page_view.debug_info_menu_item.click()

        assert_that(debug_info.title, is_(eventually_visible()))
github sneakypete81 / updatescanner / test / functional / test_page_view.py View on Github external
def test_links_work_in_pages(self):
        sidebar.updatescanner_website_item.click()
        content.updatescanner_website_install_link.click()

        assert_that(content.amo_website_page, is_(eventually_visible()))
github localwiki / localwiki-backend-server / localwiki / users / views.py View on Github external
# Check to see if they've edited a region recently
        edited_pages = Page.versions.filter(version_info__user=user)
        referer = request.META.get('HTTP_REFERER')
        if edited_pages.exists():
            region = edited_pages[0].region
            return Page(name=pagename, region=region)
        # Let's try and guess by the previous URL. Ugh!
        if referer:
            urlparts = urllib_parse.urlparse(referer)
            # Is this host us?
            for host in settings.ALLOWED_HOSTS:
                if urlparts.netloc.endswith(host):
                    pathparts = parts.path.split('/')
                    # Is the path in a region?
                    if len(pathparts) > 1 and Region.objects.filter(slug=pathparts[1]).exists():
                        return Page(name=pagename, region=Region.objects.get(slug=pathparts[1]))

        # Put it in the main region for now :/
        return Page(name=pagename, region=get_main_region())