Skip to content

Commit

Permalink
[change] Add more tests to improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
purhan committed Jan 2, 2021
1 parent e685000 commit c5890b7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions openwisp_ipam/tests/test_multitenant.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@

from . import CreateModelsMixin, PostDataMixin

from openwisp_ipam.api.utils import (
FilterByOrganization,
FilterByParent,
AuthorizeCSVImport,
FilterSerializerByOrganization,
)


User = get_user_model()
IpAddress = load_model('openwisp_ipam', 'IPAddress')
Subnet = load_model('openwisp_ipam', 'Subnet')
Expand Down Expand Up @@ -403,3 +411,22 @@ def test_browsable_api_ipaddress_list(self):
)
self.assertContains(response, '10.0.0.0/24</option>')
self.assertContains(response, '10.10.0.0/24</option>')

def test_not_implemented_error(self):
with self.assertRaises(NotImplementedError):
FilterByOrganization.get_organization_queryset(self)

with self.assertRaises(NotImplementedError):
FilterByParent.get_parent_queryset(self)

with self.assertRaises(NotImplementedError):
FilterByParent.get_organization_queryset(self)

with self.assertRaises(NotImplementedError):
AuthorizeCSVImport.get_csv_organization(self)

with self.assertRaises(NotImplementedError):
AuthorizeCSVImport.get_user_organizations(self)

with self.assertRaises(NotImplementedError):
FilterSerializerByOrganization.filter_fields(self)

0 comments on commit c5890b7

Please sign in to comment.