-
-
Save ahsan518/16dabafe8677cf262eebd061066715d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
====================================================================== | |
ERROR: craton.tests.unit.test_api.APIV1NetDevicesTest.test_get_netdevices_get_by_id | |
---------------------------------------------------------------------- | |
testtools.testresult.real._StringException: Traceback (most recent call last): | |
File "/home/ubuntu/craton/.tox/py35/lib/python3.5/site-packages/mock/mock.py", line 1305, in patched | |
return func(*args, **keywargs) | |
File "/home/ubuntu/craton/craton/tests/unit/test_api.py", line 643, in test_get_netdevices_get_by_id | |
self.assertEqual(resp.json["name"], fake_resources.NETDEVICE1.name) | |
KeyError: 'name' | |
-------------------- >> begin captured stdout << --------------------- | |
{'message': 'Unknown Error', 'status': 500} | |
--------------------- >> end captured stdout << ---------------------- | |
-------------------- >> begin captured logging << -------------------- | |
craton.api.v1.resources.inventory.networks: ERROR: Error during NetDeviceById.get: 'NetDevice' object has no attribute 'resolved' | |
--------------------- >> end captured logging << --------------------- | |
---------------------------------------------------------------------- | |
Ran 208 tests in 2.571s | |
FAILED (errors=1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 class NetDevice(): | |
~ 131 def __init__(self, name, project_id, region_id, device_type, ip_address): | |
+ 132 ┆ self.name = name | |
+ 133 ┆ self.project_id = project_id | |
134 ┆ self.region_id = region_id | |
+ 135 ┆ self.device_type = device_type | |
136 ┆ self.ip_address = ip_address | |
137 | |
138 def items(self): | |
139 ┆ return iter(self.__dict__.items()) | |
140 | |
~_141 NETDEVICE1 = NetDevice('NetDevice1', 1, 1, 1, '10.10.0.1') | |
142 NETDEVICE_LIST1 = [NETDEVICE1] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ 638 @mock.patch.object(dbapi, 'netdevices_get_by_id') | |
+ 639 def test_get_netdevices_get_by_id(self, mock_devices): | |
+ 640 ┆ mock_devices.return_value = fake_resources.NETDEVICE1 | |
+ 641 ┆ resp = self.get('/v1/netdevices/1') | |
+ 642 ┆ print (resp.json) | |
+ 643 ┆ self.assertEqual(resp.json["name"], fake_resources.NETDEVICE1.name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment