Skip to content

Commit 82659a4

Browse files
committed
Raise exception when get an unsupported model
1 parent 9cfd83b commit 82659a4

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

glassfrog/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def _detail(self, resource_class):
5757
class UnsupportedModelMixin:
5858
@classmethod
5959
def get(cls, id):
60-
return cls(data={'id': id})
60+
raise exceptions.UnsupportedModelException()
6161

6262
@classmethod
6363
def list(cls):

tests/unit/tests_models/tests_accountability.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_list(self):
3636
def test_detail(self):
3737
data = [self.sample_data()[0]]
3838
with self.patch_get(resource='accountabilities', data=data, many=True) as get:
39-
accountability = models.Accountability.get(id=666)
39+
with self.assertRaises(exceptions.UnsupportedModelException):
40+
models.Accountability.get(id=666)
4041

41-
self.assertEqual(666, accountability.id)
4242
self.assertEqual(0, get.call_count)

tests/unit/tests_models/tests_domain.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_list(self):
3636
def test_detail(self):
3737
data = [self.sample_data()[0]]
3838
with self.patch_get(resource='domains', data=data, many=True) as get:
39-
domain = models.Domain.get(id=666)
39+
with self.assertRaises(exceptions.UnsupportedModelException):
40+
models.Domain.get(id=666)
4041

41-
self.assertEqual(666, domain.id)
4242
self.assertEqual(0, get.call_count)

tests/unit/tests_models/tests_organization.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_list(self):
3636
def test_detail(self):
3737
data = [self.sample_data()[0]]
3838
with self.patch_get(resource='organizations', data=data, many=True) as get:
39-
organization = models.Organization.get(id=666)
39+
with self.assertRaises(exceptions.UnsupportedModelException):
40+
models.Organization.get(id=666)
4041

41-
self.assertEqual(666, organization.id)
4242
self.assertEqual(0, get.call_count)

tests/unit/tests_models/tests_policy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_list(self):
3636
def test_detail(self):
3737
data = [self.sample_data()[0]]
3838
with self.patch_get(resource='policies', data=data, many=True) as get:
39-
policy = models.Policy.get(id=666)
39+
with self.assertRaises(exceptions.UnsupportedModelException):
40+
models.Policy.get(id=666)
4041

41-
self.assertEqual(666, policy.id)
4242
self.assertEqual(0, get.call_count)

tests/unit/tests_models/tests_project.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_list(self):
3636
def test_detail(self):
3737
data = [self.sample_data()[0]]
3838
with self.patch_get(resource='projects', data=data, many=True) as get:
39-
project = models.Project.get(id=666)
39+
with self.assertRaises(exceptions.UnsupportedModelException):
40+
models.Project.get(id=666)
4041

41-
self.assertEqual(666, project.id)
4242
self.assertEqual(0, get.call_count)

0 commit comments

Comments
 (0)