Skip to content

Commit 3986549

Browse files
Merge pull request #113 from pehala/context
Fix APIObject ignoring context override
2 parents 841da48 + 10f58e5 commit 3986549

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

ansible/rebuild_module.digest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0f98b612b97ffcc98304fc9581a8727a -
1+
45e5927b24842946eaf6fab1a145810f -

ansible/roles/openshift_client_python/library/openshift_client_python.py

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/openshift/apiobject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def __init__(self, dict_to_model=None, string_to_model=None, context=None):
103103
# make sure to force a namespace.
104104

105105
self.context = copy.copy(context if context else cur_context())
106-
self.context.project_name = self.namespace(None)
106+
self.context.project_name = self.namespace(self.context.project_name)
107107

108108
def as_dict(self):
109109
"""

packages/openshift/test_apiobject.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import unittest
22

3+
from openshift import Context
34
from .apiobject import APIObject
45

56

@@ -12,6 +13,12 @@ def test_empty(self):
1213
self.assertEqual(obj.as_json(), '{}')
1314
self.assertIsNone(obj.context.project_name)
1415

16+
def test_context(self):
17+
context = Context()
18+
context.project_name = "my-project"
19+
obj = APIObject(context=context)
20+
self.assertEqual(obj.context.project_name, context.project_name)
21+
1522

1623
if __name__ == '__main__':
1724
unittest.main()

0 commit comments

Comments
 (0)