Ejemplo n.º 1
0
 def _do_fake_registration(self):
     # Create a Zone and DeviceZone to fool the Device into thinking it's registered
     zone = Zone(name="The Danger Zone", description="Welcome to it.")
     zone.save()
     device = Device.get_own_device()
     deviceZone = DeviceZone(device=device, zone=zone)
     deviceZone.save()
Ejemplo n.º 2
0
def do_fake_registration():
    """
    Register the device, in case some feature being tested depends on it. Will be undone by the database teardown.
    """
    # Create a Zone and DeviceZone to fool the Device into thinking it's registered
    zone = Zone(name="The Danger Zone", description="Welcome to it.")
    zone.save()
    device = Device.get_own_device()
    device_zone = DeviceZone(device=device, zone=zone)
    device_zone.save()
Ejemplo n.º 3
0
    def test_cannot_delete_full_zone(self):
        # Save zone info, but without adding
        self.devicezone = DeviceZone(device=Device.get_own_device(), zone=self.zone)
        self.devicezone.save()

        # Check on the org management page
        self.browser_login_user(self.USER_EMAIL, self.USER_PASSWORD)
        with self.assertRaises(NoSuchElementException):
            self.assertEqual(self.browser.find_element_by_css_selector(".zone-delete-link"), None, "Make sure 'delete' link is gone.")

        # Follow the link, and confirm on the zone management page.
        zone_url = self.browser.find_element_by_css_selector(".zone-manage-link").get_attribute("href")
        self.browse_to(zone_url)
        self.assertEqual(self.browser.current_url, zone_url, "Expect link to go to zone management page")
        with self.assertRaises(NoSuchElementException):
            self.assertEqual(self.browser.find_element_by_css_selector(".zone-delete-link"), None, "Make sure 'delete' link is gone.")