def test_remove_geofence(self, name):
        policy = AuthPolicy()
        retrieved = policy.get_policy()
        self.assertEqual(len(retrieved['factors']), 1)
        self.assertEqual(policy.geofences, [])

        policy.add_geofence(MagicMock(spec=int), MagicMock(spec=int), MagicMock(spec=int), name)
        self.assertEqual(len(policy.geofences), 1)
        retrieved = policy.get_policy()
        self.assertEqual(len(retrieved['factors']), 2)
        self.assertEqual(len(retrieved['factors'][1]['attributes']['locations']), 1)

        policy.remove_geofence(name)
        self.assertEqual(policy.geofences, [])
        retrieved = policy.get_policy()
        self.assertEqual(len(retrieved['factors'][1]['attributes']['locations']), 0)
Ejemplo n.º 2
0
    def test_remove_geofence(self, name):
        policy = AuthPolicy()
        retrieved = policy.get_policy()
        self.assertEqual(len(retrieved['factors']), 1)
        self.assertEqual(policy.geofences, [])

        policy.add_geofence(MagicMock(spec=int), MagicMock(spec=int),
                            MagicMock(spec=int), name)
        self.assertEqual(len(policy.geofences), 1)
        retrieved = policy.get_policy()
        self.assertEqual(len(retrieved['factors']), 2)
        self.assertEqual(
            len(retrieved['factors'][1]['attributes']['locations']), 1)

        policy.remove_geofence(name)
        self.assertEqual(policy.geofences, [])
        retrieved = policy.get_policy()
        self.assertEqual(
            len(retrieved['factors'][1]['attributes']['locations']), 0)
Ejemplo n.º 3
0
 def test_remove_invalid_geofence(self):
     policy = AuthPolicy()
     policy.add_geofence(1, 1, 2)
     with self.assertRaises(InvalidGeoFenceName):
         policy.remove_geofence(MagicMock(spec=str))
Ejemplo n.º 4
0
 def test_remove_partially_invalid_geofence(self):
     policy = AuthPolicy()
     policy.add_geofence(1, 1, 2, 'name')
     policy.geofences.pop()
     with self.assertRaises(InvalidGeoFenceName):
         policy.remove_geofence('name')
 def test_remove_partially_invalid_geofence(self):
     policy = AuthPolicy()
     policy.add_geofence(1, 1, 2, 'name')
     policy.geofences.pop()
     with self.assertRaises(InvalidGeoFenceName):
         policy.remove_geofence('name')
 def test_remove_invalid_geofence(self):
     policy = AuthPolicy()
     policy.add_geofence(1, 1, 2)
     with self.assertRaises(InvalidGeoFenceName):
         policy.remove_geofence(MagicMock(spec=str))