def test_find_vlans_in_org_no_duplicates(self): """Should filter duplicates""" self.org3.vlan_set.all.return_value = [self.vlan3, self.vlan2] self.assertEqual(sorted(find_vlans_in_org(self.org1)), sorted([FantasyVlan(self.vlan3.vlan), FantasyVlan(self.vlan2.vlan), FantasyVlan(self.vlan1.vlan)]))
def test_find_vlans_in_org_one_child(self): """Should return all vlans in this org and child org""" self.assertEqual( sorted(find_vlans_in_org(self.org2)), sorted( [FantasyVlan(self.vlan3.vlan), FantasyVlan(self.vlan2.vlan)]))
def test_find_vlans_in_org_filter_nonevalues(self): """Should filter vlans with no vlan value""" self.vlan1.vlan = None self.assertEqual( sorted(find_vlans_in_org(self.org1)), sorted( [FantasyVlan(self.vlan3.vlan), FantasyVlan(self.vlan2.vlan)]))
def test_find_vlans_in_org_two_children(self): """Should return all vlans in this org and all children orgs""" self.assertEqual( sorted(find_vlans_in_org(self.org1)), sorted([ FantasyVlan(self.vlan3.vlan), FantasyVlan(self.vlan2.vlan), FantasyVlan(self.vlan1.vlan) ]))
def test_find_vlans_in_org_no_duplicates(self): """Should filter duplicates""" self.org3.vlan_set.all.return_value = [self.vlan3, self.vlan2] self.assertEqual( sorted(find_vlans_in_org(self.org1)), sorted([ FantasyVlan(self.vlan3.vlan), FantasyVlan(self.vlan2.vlan), FantasyVlan(self.vlan1.vlan) ]))
def test_find_vlans_in_org_no_children(self): """Should return all vlans in this org""" self.assertEqual(find_vlans_in_org(self.org3), [FantasyVlan(self.vlan3.vlan)])
def test_find_vlans_in_org_filter_nonevalues(self): """Should filter vlans with no vlan value""" self.vlan1.vlan = None self.assertEqual(sorted(find_vlans_in_org(self.org1)), sorted([FantasyVlan(self.vlan3.vlan), FantasyVlan(self.vlan2.vlan)]))
def test_find_vlans_in_org_two_children(self): """Should return all vlans in this org and all children orgs""" self.assertEqual(sorted(find_vlans_in_org(self.org1)), sorted([FantasyVlan(self.vlan3.vlan), FantasyVlan(self.vlan2.vlan), FantasyVlan(self.vlan1.vlan)]))
def test_find_vlans_in_org_one_child(self): """Should return all vlans in this org and child org""" self.assertEqual(sorted(find_vlans_in_org(self.org2)), sorted([FantasyVlan(self.vlan3.vlan), FantasyVlan(self.vlan2.vlan)]))
def test_find_vlans_in_org_no_children(self): """Should return all vlans in this org""" self.assertEqual(find_vlans_in_org(self.org3), [FantasyVlan(self.vlan3.vlan)])