-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3226 from Uninett/bugfix/netmap-stub-netbox-eq-fix
Fix broken `__eq__` implementation of Netbox stub class
- Loading branch information
Showing
3 changed files
with
21 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix spurious crashing when loading some Netmap layer 3 views |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from nav.netmap.stubs import Netbox | ||
from nav.models import manage | ||
|
||
|
||
class TestNetboxEqWithNonStubValues: | ||
def test_when_value_is_orm_model_with_same_sysname_it_should_return_true(self): | ||
localhost = manage.Netbox(sysname='localhost') | ||
stub = Netbox() | ||
stub.sysname = localhost.sysname | ||
assert stub == localhost | ||
|
||
def test_when_value_is_orm_model_with_different_sysname_it_should_return_false( | ||
self, | ||
): | ||
localhost = manage.Netbox(sysname='localhost') | ||
stub = Netbox() | ||
stub.sysname = "stubhost" | ||
assert stub != localhost |