OpenWISP

Fix django-netjsonconfig issue #62

Fix django-netjsonconfig issue #62

Add hostname validator to Device.name:

First of all, ensure you know

How to reproduce the issue: try to save a new device with name test device.

Result: netjsonconfig validation complains test device is not a valid hostname and the validation error is shown in the configuration section.

Test: write a unit test that triggers the validation error and checks the message_dict property of the exception contains a key named "name".

Fix: now implement the fix for your test by writing a hostname validator for the name field.

More paranoid tests: write more paranoid unit tests that ensure legitimate names are allowed and invalid names are not, be creative in trying different cases that you didn't think for.

Task tags

  • TDD
  • python
  • git
  • networking
  • django

Students who completed this task

Aarnav Bos

Task type

  • code Code
  • done_all Quality Assurance
close

2017