-
Notifications
You must be signed in to change notification settings - Fork 153
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 #54 from Rob-Johnson/make-test-useful
implement __eq__ on base models + fix tests to be useful
- Loading branch information
Showing
3 changed files
with
22 additions
and
3 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
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 |
---|---|---|
@@ -1,12 +1,22 @@ | ||
import mock | ||
import requests_mock | ||
from marathon import MarathonClient | ||
from marathon import models | ||
|
||
|
||
@requests_mock.mock() | ||
def test_get_deployments(m): | ||
fake_response = '[ { "affectedApps": [ "/test" ], "id": "867ed450-f6a8-4d33-9b0e-e11c5513990b", "steps": [ [ { "action": "ScaleApplication", "app": "/test" } ] ], "currentActions": [ { "action": "ScaleApplication", "app": "/test" } ], "version": "2014-08-26T08:18:03.595Z", "currentStep": 1, "totalSteps": 1 } ]' | ||
fake_response = '[ { "affectedApps": [ "/test" ], "id": "fakeid", "steps": [ [ { "action": "ScaleApplication", "app": "/test" } ] ], "currentActions": [ { "action": "ScaleApplication", "app": "/test" } ], "version": "fakeversion", "currentStep": 1, "totalSteps": 1 } ]' | ||
m.get('http://fake_server/v2/deployments', text=fake_response) | ||
mock_client = MarathonClient(servers='http://fake_server') | ||
response = mock_client.list_deployments() | ||
print response | ||
actual_deployments = mock_client.list_deployments() | ||
expected_deployments = [ models.MarathonDeployment( | ||
id=u"fakeid", | ||
steps=[[models.MarathonDeploymentAction(action="ScaleApplication", app="/test")]], | ||
current_actions=[models.MarathonDeploymentAction(action="ScaleApplication", app="/test")], | ||
current_step=1, | ||
total_steps=1, | ||
affected_apps=[u"/test"], | ||
version=u"fakeversion" | ||
)] | ||
assert expected_deployments == actual_deployments |