Revision 97ca522f snf-cyclades-app/synnefo/api/tests/subnets.py

b/snf-cyclades-app/synnefo/api/tests/subnets.py
92 92
                             json.dumps(request), "json")
93 93
        self.assertSuccess(response)
94 94

  
95
    def test_create_subnet_success_ipv4_with_slac(self):
96
        """Test create an IPv4 subnet, with a slac that will be ingored"""
97
        test_net = mf.NetworkFactory()
98
        request = {
99
            'subnet': {
100
                'network_id': test_net.id,
101
                'cidr': '10.0.3.0/24',
102
                'ip_version': 4,
103
                'slac': False}
104
        }
105
        response = self.post(SUBNETS_URL, test_net.userid,
106
                             json.dumps(request), "json")
107
        self.assertSuccess(response)
108

  
109
    def test_create_subnet_success_ipv6_with_slac(self):
110
        """Test create a subnet with ipv6 and slac"""
111
        test_net = mf.NetworkFactory()
112
        request = {
113
            'subnet': {
114
                'network_id': test_net.id,
115
                'cidr': 'fdc1:4992:1130:fc0b::/64',
116
                'ip_version': 6,
117
                'slac': False}
118
        }
119
        response = self.post(SUBNETS_URL, test_net.userid,
120
                             json.dumps(request), "json")
121
        self.assertSuccess(response)
122

  
123
    def test_create_subnet_with_malformed_slac(self):
124
        """Test create a subnet with ipv6 and a malformed slac"""
125
        test_net = mf.NetworkFactory()
126
        request = {
127
            'subnet': {
128
                'network_id': test_net.id,
129
                'cidr': 'fdc1:4992:1130:fc0b::/64',
130
                'ip_version': 6,
131
                'slac': 'Random'}
132
        }
133
        response = self.post(SUBNETS_URL, test_net.userid,
134
                             json.dumps(request), "json")
135
        self.assertBadRequest(response)
136

  
95 137
    def test_create_subnet_success_ipv6(self):
96 138
        """Test create an IPv6 subnet successfully"""
97 139
        test_net = mf.NetworkFactory()
......
287 329
                             "json")
288 330
        self.assertBadRequest(response)
289 331

  
332
    def test_create_subnet_with_dhcp_set_to_false(self):
333
        """Create a subnet with a dhcp set to false"""
334
        test_net = mf.NetworkFactory()
335
        request = {
336
            'subnet': {
337
                'network_id': test_net.id,
338
                'cidr': '192.168.3.0/24',
339
                'enable_dhcp': False}
340
        }
341
        response = self.post(SUBNETS_URL, test_net.userid, json.dumps(request),
342
                             "json")
343
        self.assertSuccess(response)
344

  
290 345
    def test_create_subnet_with_dns_nameservers(self):
291 346
        """Create a subnet with dns nameservers"""
292 347
        test_net = mf.NetworkFactory()

Also available in: Unified diff