> [0]
>
> 50 === added file 'src/maasserver/tests/test_api_networks.py'
> [...]
> 83 + def test_list_returns_network(self):
>
> The name of this test is strange. One would expect
> test_list_returns_network*s*
Except in this case it's only one.
> [1]
>
> 50 === added file 'src/maasserver/tests/test_api_networks.py'
> [...]
> 83 + def test_list_returns_network(self):
>
> I put a break point in this test and look:
>
> (Pdb) parsed_result
> [{u'description': u'tjBXqFQ7vK', u'ip': u'217.187.192.0', u'_state':
> u'<django.db.models.base.ModelState object at 0x962acd0>', u'netmask':
> u'255.255.192.0', u'vlan_tag': None, u'id': 1, u'name': u'6THuCI'}]
>
> Django adds clutter to the objects (I'm talking about the '_state' field) so
> we need to explicitly list the fields that we want to return.
That goes in NetworkHandler.fields I believe, which is in one of the later branches in this series. I'll add it there.
The same words went through my head, believe me! The problem is that in this case, the object has the expected values and the dict has the tested values.
> [3]
>
> 50 === added file 'src/maasserver/tests/test_api_networks.py'
> [...]
> 93 + (
> 94 + original_network.name,
> 95 + original_network.ip,
> 96 + original_network.netmask,
> 97 + original_network.vlan_tag,
> 98 + original_network.description,
> 99 + ),
> 100 + (
> 101 + returned_network['name'],
> 102 + returned_network['ip'],
> 103 + returned_network['netmask'],
> 104 + returned_network['vlan_tag'],
> 105 + returned_network['description'],
> 106 + ))
>
> There is a bug: we should also have a 'resource_uri' field.
> [0] /tests/ test_api_ networks. py' returns_ network( self): returns_ network* s*
>
> 50 === added file 'src/maasserver
> [...]
> 83 + def test_list_
>
> The name of this test is strange. One would expect
> test_list_
Except in this case it's only one.
> [1] /tests/ test_api_ networks. py' returns_ network( self): db.models. base.ModelState object at 0x962acd0>', u'netmask':
>
> 50 === added file 'src/maasserver
> [...]
> 83 + def test_list_
>
> I put a break point in this test and look:
>
> (Pdb) parsed_result
> [{u'description': u'tjBXqFQ7vK', u'ip': u'217.187.192.0', u'_state':
> u'<django.
> u'255.255.192.0', u'vlan_tag': None, u'id': 1, u'name': u'6THuCI'}]
>
> Django adds clutter to the objects (I'm talking about the '_state' field) so
> we need to explicitly list the fields that we want to return.
That goes in NetworkHandler. fields I believe, which is in one of the later branches in this series. I'll add it there.
> [2] /tests/ test_api_ networks. py' network. name, network. ip, network. netmask, network. vlan_tag, network. description, network[ 'name'] , network[ 'ip'], network[ 'netmask' ], network[ 'vlan_tag' ], network[ 'description' ], ibutes?
>
> 50 === added file 'src/maasserver
> [...]
> 93 + (
> 94 + original_
> 95 + original_
> 96 + original_
> 97 + original_
> 98 + original_
> 99 + ),
> 100 + (
> 101 + returned_
> 102 + returned_
> 103 + returned_
> 104 + returned_
> 105 + returned_
> 106 + ))
>
> Couldn't this benefit from self.assertAttr
The same words went through my head, believe me! The problem is that in this case, the object has the expected values and the dict has the tested values.
> [3] /tests/ test_api_ networks. py' network. name, network. ip, network. netmask, network. vlan_tag, network. description, network[ 'name'] , network[ 'ip'], network[ 'netmask' ], network[ 'vlan_tag' ], network[ 'description' ],
>
> 50 === added file 'src/maasserver
> [...]
> 93 + (
> 94 + original_
> 95 + original_
> 96 + original_
> 97 + original_
> 98 + original_
> 99 + ),
> 100 + (
> 101 + returned_
> 102 + returned_
> 103 + returned_
> 104 + returned_
> 105 + returned_
> 106 + ))
>
> There is a bug: we should also have a 'resource_uri' field.
Yeah, I added that in one of the other branches.