Example #1
0
 def test_raises_if_missing_mac(self):
     user = factory.make_User()
     handler = DiscoveryHandler(user, {}, None)
     disco = factory.make_Discovery()
     num_discoveries = Discovery.objects.count()
     self.assertThat(num_discoveries, Equals(1))
     with ExpectedException(HandlerPermissionError):
         handler.delete_by_mac_and_ip(dict(ip=disco.ip))
Example #2
0
 def test_deletes_discovery_and_returns_number_deleted(self):
     user = factory.make_admin()
     handler = DiscoveryHandler(user, {}, None)
     disco = factory.make_Discovery()
     num_discoveries = Discovery.objects.count()
     self.assertThat(num_discoveries, Equals(1))
     result = handler.delete_by_mac_and_ip(
         dict(ip=disco.ip, mac=disco.mac_address))
     num_discoveries = Discovery.objects.count()
     self.assertThat(num_discoveries, Equals(0))
     self.assertThat(result, Equals(1))