def test_exportBlueprint(self, get_server_info_mock, performGetOperationMock, openMock): performGetOperationMock.return_value = '200' blueprintUrl = 'http://localhost:8080/api/v1/clusters/blueprint' +\ '-multinode-default?format=blueprint' AmbariBlueprint.SILENT = True ambariBlueprint = AmbariBlueprint() ambariBlueprint.exportBlueprint('blueprint-multinode-default', '/tmp/test') openMock.assertCalled() get_server_info_mock.assertCalled() performGetOperationMock.assert_called_with(blueprintUrl) pass
def test_importBlueprint(self, get_server_info_mock, performPostOperationMock): performPostOperationMock.side_effect = ['201', '202'] BLUEPRINT_POST_JSON = open(self.TEST_BLUEPRINT).read() BLUEPRINT_HOST_JSON = open(self.BLUEPRINT_HOSTS).read() blueprintUrl = 'http://localhost:8080/api/v1/blueprints/blueprint-multinode-default' hostCreateUrl = 'http://localhost:8080/api/v1/clusters/c1' AmbariBlueprint.SILENT = True ambariBlueprint = AmbariBlueprint() ambariBlueprint.importBlueprint(self.TEST_BLUEPRINT, self.BLUEPRINT_HOSTS, "c1") get_server_info_mock.assertCalled() performPostOperationMock.assert_has_calls([ call(blueprintUrl, BLUEPRINT_POST_JSON), call(hostCreateUrl, BLUEPRINT_HOST_JSON) ]) pass