<s> from solumclient . openstack . common . apiclient import exceptions <EOL> from solumclient . openstack . common . apiclient import fake_client <EOL> from solumclient . tests import base <EOL> from solumclient . v1 import client as sclient <EOL> from solumclient . v1 import pipeline <EOL> pipeline_list = [ <EOL> { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:type>' : '<STR_LIT>' , <EOL> '<STR_LIT:description>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } , <EOL> { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:type>' : '<STR_LIT>' , <EOL> '<STR_LIT:description>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> ] <EOL> pipeline_fixture = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:type>' : '<STR_LIT>' , <EOL> '<STR_LIT:description>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> fixtures_list = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:GET>' : ( <EOL> { } , <EOL> pipeline_list <EOL> ) , <EOL> } <EOL> } <EOL> fixtures_get = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:GET>' : ( <EOL> { } , <EOL> pipeline_fixture <EOL> ) , <EOL> } <EOL> } <EOL> fixtures_create = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:POST>' : ( <EOL> { } , <EOL> pipeline_fixture <EOL> ) , <EOL> } <EOL> } <EOL> fixtures_put = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : ( <EOL> { } , <EOL> pipeline_fixture <EOL> ) , <EOL> } <EOL> } <EOL> fixtures_delete = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : ( <EOL> { } , <EOL> { } , <EOL> ) , <EOL> } <EOL> } <EOL> class PipelineManagerTest ( base . TestCase ) : <EOL> def assert_pipeline_object ( self , pipeline_obj ) : <EOL> self . assertIn ( '<STR_LIT>' , repr ( pipeline_obj ) ) <EOL> self . assertEqual ( pipeline_fixture [ '<STR_LIT>' ] , pipeline_obj . uri ) <EOL> self . assertEqual ( pipeline_fixture [ '<STR_LIT:type>' ] , pipeline_obj . type ) <EOL> self . assertEqual ( pipeline_fixture [ '<STR_LIT>' ] , <EOL> pipeline_obj . project_id ) <EOL> self . assertEqual ( pipeline_fixture [ '<STR_LIT>' ] , pipeline_obj . user_id ) <EOL> def test_list_all ( self ) : <EOL> fake_http_client = fake_client . FakeHTTPClient ( fixtures = fixtures_list ) <EOL> api_client = sclient . Client ( fake_http_client ) <EOL> mgr = pipeline . PipelineManager ( api_client ) <EOL> pipelines = mgr . list ( ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( pipelines ) ) <EOL> self . assertIn ( '<STR_LIT>' , repr ( pipelines [ <NUM_LIT:0> ] ) ) <EOL> self . assertEqual ( pipeline_list [ <NUM_LIT:0> ] [ '<STR_LIT>' ] , pipelines [ <NUM_LIT:0> ] . uri ) <EOL> self . assertEqual ( pipeline_list [ <NUM_LIT:1> ] [ '<STR_LIT>' ] , pipelines [ <NUM_LIT:1> ] . uri ) <EOL> def test_find_one ( self ) : <EOL> fake_http_client = fake_client . FakeHTTPClient ( fixtures = fixtures_list ) <EOL> api_client = sclient . Client ( fake_http_client ) <EOL> mgr = pipeline . PipelineManager ( api_client ) <EOL> pipelines = mgr . findall ( name = '<STR_LIT>' ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( pipelines ) ) <EOL> self . assertIn ( '<STR_LIT>' , repr ( pipelines [ <NUM_LIT:0> ] ) ) <EOL> self . assertEqual ( pipeline_list [ <NUM_LIT:0> ] [ '<STR_LIT>' ] , pipelines [ <NUM_LIT:0> ] . uri ) <EOL> def test_find_one_only ( self ) : <EOL> fake_http_client = fake_client . FakeHTTPClient ( fixtures = fixtures_list ) <EOL> api_client = sclient . Client ( fake_http_client ) <EOL> mgr = pipeline . PipelineManager ( api_client ) <EOL> result = mgr . find ( name_or_id = '<STR_LIT>' ) <EOL> self . assertEqual ( pipeline_list [ <NUM_LIT:0> ] [ '<STR_LIT>' ] , result . uri ) <EOL> def test_find_none ( self ) : <EOL> fake_http_client = fake_client . FakeHTTPClient ( fixtures = fixtures_list ) <EOL> api_client = sclient . Client ( fake_http_client ) <EOL> mgr = pipeline . PipelineManager ( api_client ) <EOL> self . assertRaises ( exceptions . NotFound , mgr . find , name_or_id = '<STR_LIT>' ) <EOL> def test_create ( self ) : <EOL> fake_http_client = fake_client . FakeHTTPClient ( fixtures = fixtures_create ) <EOL> api_client = sclient . Client ( fake_http_client ) <EOL> mgr = pipeline . PipelineManager ( api_client ) <EOL> pipeline_obj = mgr . create ( ) <EOL> self . assert_pipeline_object ( pipeline_obj ) <EOL> def test_get ( self ) : <EOL> fake_http_client = fake_client . FakeHTTPClient ( fixtures = fixtures_get ) <EOL> api_client = sclient . Client ( fake_http_client ) <EOL> mgr = pipeline . PipelineManager ( api_client ) <EOL> pipeline_obj = mgr . get ( pipeline_id = '<STR_LIT>' ) <EOL> self . assert_pipeline_object ( pipeline_obj ) <EOL> def test_put ( self ) : <EOL> fake_http_client = fake_client . FakeHTTPClient ( fixtures = fixtures_put ) <EOL> api_client = sclient . Client ( fake_http_client ) <EOL> mgr = pipeline . PipelineManager ( api_client ) <EOL> pipeline_obj = mgr . put ( pipeline_id = '<STR_LIT>' ) <EOL> self . assert_pipeline_object ( pipeline_obj ) <EOL> def test_delete ( self ) : <EOL> fake_http_client = fake_client . FakeHTTPClient ( fixtures = fixtures_delete ) <EOL> api_client = sclient . Client ( fake_http_client ) <EOL> mgr = pipeline . PipelineManager ( api_client ) <EOL> mgr . delete ( pipeline_id = '<STR_LIT>' ) <EOL> fake_http_client . assert_called ( '<STR_LIT>' , '<STR_LIT>' ) </s>
