Ejemplo n.º 1
0
    def test_NewOpticalLinkForm_full(self):
        node_type = 'Service'
        data = {
            'service_type': 'Private Interconnect',
            'operational_state': 'In service',
            'description': 'Pretty good Interconnect service',
            'responsible_group': 'DEV',
            'support_group': 'NOC',
            'relationship_provider': helpers.get_provider_id('NORDUnet')
        }
        resp = self.client.post('/new/{}/'.format(slugify(node_type)), data)
        self.assertEqual(resp.status_code, 302)
        self.assertEqual(
            NodeType.objects.get(type=node_type).nodehandle_set.count(), 1)
        nh = NodeType.objects.get(type=node_type).nodehandle_set.first()
        self.assertEqual(resp['Location'],
                         self.get_full_url(nh.get_absolute_url()))
        del data['relationship_provider']

        node_data = nh.get_node().data
        for k in data:
            self.assertIn(k, node_data)
            self.assertEqual(data[k], node_data[k])

        self.assertEqual(len(nh.get_node().relationships), 1)
        self.assertEqual(nh.get_node().data['name'], 'SERVICE-000001')
Ejemplo n.º 2
0
 def test_NewCableForm_generated(self):
     node_type = 'Cable'
     data = {
         'cable_type': 'Patch',
         'relationship_provider': helpers.get_provider_id('NORDUnet')
     }
     resp = self.client.post('/new/{}/'.format(slugify(node_type)), data)
     self.assertEqual(resp.status_code, 302)
     self.assertEqual(
         NodeType.objects.get(type=node_type).nodehandle_set.count(), 1)
     nh = NodeType.objects.get(type=node_type).nodehandle_set.first()
     self.assertEqual(resp['Location'],
                      self.get_full_url(nh.get_absolute_url()))
     del data['relationship_provider']
     self.assertDictContainsSubset(data, nh.get_node().data)
     self.assertEqual(len(nh.get_node().relationships), 1)
     self.assertEqual(nh.get_node().data['name'], 'CABLE-000001')
Ejemplo n.º 3
0
    def test_NewCableForm_full(self):
        node_type = 'Cable'
        data = {
            'name': 'test cable',
            'cable_type': 'Patch',
            'relationship_provider': helpers.get_provider_id('NORDUnet')
        }
        resp = self.client.post('/new/{}/'.format(slugify(node_type)), data)
        self.assertEqual(resp.status_code, 302)
        self.assertEqual(
            NodeType.objects.get(type=node_type).nodehandle_set.count(), 1)
        nh = NodeType.objects.get(type=node_type).nodehandle_set.first()
        self.assertEqual(resp['Location'],
                         self.get_full_url(nh.get_absolute_url()))
        del data['relationship_provider']

        node_data = nh.get_node().data
        for k in data:
            self.assertIn(k, node_data)
            self.assertEqual(data[k], node_data[k])

        self.assertEqual(len(nh.get_node().relationships), 1)
Ejemplo n.º 4
0
 def __init__(self, *args, **kwargs):
     super(NewServiceForm, self).__init__(*args, **kwargs)
     self.fields['relationship_provider'].initial = get_provider_id(
         'NORDUnet')
Ejemplo n.º 5
0
 def __init__(self, *args, **kwargs):
     super(NewOpticalMultiplexSectionForm, self).__init__(*args, **kwargs)
     self.fields['relationship_provider'].initial = get_provider_id(
         'NORDUnet')