Merge lp:~gz/pyjuju/os_constraint_typo into lp:pyjuju

Proposed by Martin Packman
Status: Merged
Merged at revision: 561
Proposed branch: lp:~gz/pyjuju/os_constraint_typo
Merge into: lp:pyjuju
Diff against target: 0 lines
To merge this branch: bzr merge lp:~gz/pyjuju/os_constraint_typo
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+116701@code.launchpad.net

Description of the change

Fix get_constraint_set in openstack provider

Just a tyop, also adds some basic testing of the method directly on the
provider.

https://codereview.appspot.com/6446045/

To post a comment you must log in.
lp:~gz/pyjuju/os_constraint_typo updated
561. By Martin Packman

Fix typ in openstack get_constraint_set and add tests

Revision history for this message
Martin Packman (gz) wrote :

Reviewers: mp+116701_code.launchpad.net,

Message:
Please take a look.

Description:
Fix get_constraint_set in openstack provider

Just a tyop, also adds some basic testing of the method.

https://code.launchpad.net/~gz/juju/os_constraint_typo/+merge/116701

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/6446045/

Affected files:
   A [revision details]
   M juju/providers/openstack/provider.py
   M juju/providers/openstack/tests/test_provider.py

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>

Index: juju/providers/openstack/provider.py
=== modified file 'juju/providers/openstack/provider.py'
--- juju/providers/openstack/provider.py 2012-07-25 02:48:54 +0000
+++ juju/providers/openstack/provider.py 2012-07-25 17:08:30 +0000
@@ -70,7 +70,7 @@
          """Get the provider specific machine constraints.
          """
          # Use cached value if available.
- cs = self._cached_contraint.get()
+ cs = self._cached_constraint.get()
          if cs is not None:
              returnValue(cs)
          cs = yield super(MachineProvider, self).get_constraint_set()

Index: juju/providers/openstack/tests/test_provider.py
=== modified file 'juju/providers/openstack/tests/test_provider.py'
--- juju/providers/openstack/tests/test_provider.py 2012-07-05 11:45:00
+0000
+++ juju/providers/openstack/tests/test_provider.py 2012-07-25 17:08:30
+0000
@@ -2,9 +2,11 @@

  from juju.lib.testing import TestCase
  from juju.environment.errors import EnvironmentsConfigError
+from juju.machine.constraints import ConstraintSet

  from juju.providers.openstack.files import FileStorage
  from juju.providers.openstack.provider import MachineProvider
+from juju.providers.openstack.tests import OpenStackTestMixin

  class ProviderTestCase(TestCase):
@@ -114,3 +116,26 @@
              str(error),
              "Environment config cannot define both authorized-keys and "
              "authorized-keys-path. Pick one!")
+
+
+class GetConstraintSetTests(OpenStackTestMixin, TestCase):
+
+ def check_is_constraint(self, obj):
+ self.assertIsInstance(obj, ConstraintSet)
+
+ def test_once(self):
+ self.expect_nova_get("flavors",
+ response={'flavors': self.default_flavors})
+ self.mocker.replay()
+ provider = self.get_provider()
+ deferred = provider.get_constraint_set()
+ return deferred.addCallback(self.check_is_constraint)
+
+ def test_twice(self):
+ self.expect_nova_get("flavors",
+ response={'flavors': self.default_flavors})
+ self.mocker.replay()
+ provider = self.get_provider()
+ deferred = provider.get_constraint_set()
+ deferred.addCallback(lambda res: provider.get_constraint_set())
+ return deferred.addCallback(self.check_is_constraint)

Revision history for this message
Kapil Thangavelu (hazmat) wrote :

lgtm, thanks!

https://codereview.appspot.com/6446045/diff/1/juju/providers/openstack/tests/test_provider.py
File juju/providers/openstack/tests/test_provider.py (right):

https://codereview.appspot.com/6446045/diff/1/juju/providers/openstack/tests/test_provider.py#newcode126
juju/providers/openstack/tests/test_provider.py:126: def
test_once(self):
test once could and should be redundant to test twice. minor

https://codereview.appspot.com/6446045/

Revision history for this message
Kapil Thangavelu (hazmat) wrote :

*** Submitted:

Fix get_constraint_set in openstack provider

Just a tyop, also adds some basic testing of the method directly on the
provider.

R=hazmat
CC=
https://codereview.appspot.com/6446045

https://codereview.appspot.com/6446045/

Preview Diff

Empty

Subscribers

People subscribed via source and target branches

to status/vote changes: