Rename StagingApi to StagingAPI
This commit is contained in:
parent
052a74b611
commit
2268d6bdf3
@ -17,7 +17,7 @@ from osc.core import *
|
|||||||
# Expand sys.path to search modules inside the pluging directory
|
# Expand sys.path to search modules inside the pluging directory
|
||||||
_plugin_dir = os.path.expanduser('~/.osc-plugins')
|
_plugin_dir = os.path.expanduser('~/.osc-plugins')
|
||||||
sys.path.append(_plugin_dir)
|
sys.path.append(_plugin_dir)
|
||||||
from osclib.stagingapi import StagingApi
|
from osclib.stagingapi import StagingAPI
|
||||||
|
|
||||||
|
|
||||||
OSC_STAGING_VERSION='0.0.1'
|
OSC_STAGING_VERSION='0.0.1'
|
||||||
@ -406,7 +406,7 @@ def do_staging(self, subcmd, opts, *args):
|
|||||||
opts.verbose = False
|
opts.verbose = False
|
||||||
|
|
||||||
self.rings = self._staging_get_rings(opts)
|
self.rings = self._staging_get_rings(opts)
|
||||||
api = StagingApi(opts.apiurl)
|
api = StagingAPI(opts.apiurl)
|
||||||
|
|
||||||
# call the respective command and parse args by need
|
# call the respective command and parse args by need
|
||||||
if cmd in ['push', 'p']:
|
if cmd in ['push', 'p']:
|
||||||
|
@ -20,7 +20,7 @@ from osc.core import http_POST
|
|||||||
from osc.core import http_PUT
|
from osc.core import http_PUT
|
||||||
from osc.core import link_pac
|
from osc.core import link_pac
|
||||||
|
|
||||||
class StagingApi(object):
|
class StagingAPI(object):
|
||||||
"""
|
"""
|
||||||
Class containing various api calls to work with staging projects.
|
Class containing various api calls to work with staging projects.
|
||||||
"""
|
"""
|
||||||
|
@ -91,7 +91,7 @@ class TestApiCalls(unittest.TestCase):
|
|||||||
|
|
||||||
# Create the api object
|
# Create the api object
|
||||||
with mock_generate_ring_packages():
|
with mock_generate_ring_packages():
|
||||||
api = oscs.StagingApi('http://localhost')
|
api = oscs.StagingAPI('http://localhost')
|
||||||
self.assertEqual(ring_packages, api.ring_packages)
|
self.assertEqual(ring_packages, api.ring_packages)
|
||||||
|
|
||||||
@httpretty.activate
|
@httpretty.activate
|
||||||
@ -112,7 +112,7 @@ class TestApiCalls(unittest.TestCase):
|
|||||||
|
|
||||||
# Initiate the api with mocked rings
|
# Initiate the api with mocked rings
|
||||||
with mock_generate_ring_packages():
|
with mock_generate_ring_packages():
|
||||||
api = oscs.StagingApi('http://localhost')
|
api = oscs.StagingAPI('http://localhost')
|
||||||
|
|
||||||
# get the open requests
|
# get the open requests
|
||||||
requests = api.dispatch_open_requests()
|
requests = api.dispatch_open_requests()
|
||||||
@ -132,7 +132,7 @@ class TestApiCalls(unittest.TestCase):
|
|||||||
|
|
||||||
# Initiate the api with mocked rings
|
# Initiate the api with mocked rings
|
||||||
with mock_generate_ring_packages():
|
with mock_generate_ring_packages():
|
||||||
api = oscs.StagingApi('http://localhost')
|
api = oscs.StagingAPI('http://localhost')
|
||||||
|
|
||||||
# Ensure the output is equal to what we expect
|
# Ensure the output is equal to what we expect
|
||||||
data = api.get_prj_pseudometa('openSUSE:Factory:Staging:test1')
|
data = api.get_prj_pseudometa('openSUSE:Factory:Staging:test1')
|
||||||
@ -161,7 +161,7 @@ class TestApiCalls(unittest.TestCase):
|
|||||||
|
|
||||||
# Initiate the api with mocked rings
|
# Initiate the api with mocked rings
|
||||||
with mock_generate_ring_packages():
|
with mock_generate_ring_packages():
|
||||||
api = oscs.StagingApi('http://localhost')
|
api = oscs.StagingAPI('http://localhost')
|
||||||
|
|
||||||
# Compare the results
|
# Compare the results
|
||||||
self.assertEqual(prjlist,
|
self.assertEqual(prjlist,
|
||||||
@ -181,7 +181,7 @@ class TestApiCalls(unittest.TestCase):
|
|||||||
|
|
||||||
# Initiate the api with mocked rings
|
# Initiate the api with mocked rings
|
||||||
with mock_generate_ring_packages():
|
with mock_generate_ring_packages():
|
||||||
api = oscs.StagingApi('http://localhost')
|
api = oscs.StagingAPI('http://localhost')
|
||||||
|
|
||||||
# get the open requests
|
# get the open requests
|
||||||
requests = api.get_open_requests()
|
requests = api.get_open_requests()
|
||||||
@ -207,7 +207,7 @@ class TestApiCalls(unittest.TestCase):
|
|||||||
|
|
||||||
# Initiate the api with mocked rings
|
# Initiate the api with mocked rings
|
||||||
with mock_generate_ring_packages():
|
with mock_generate_ring_packages():
|
||||||
api = oscs.StagingApi('http://localhost')
|
api = oscs.StagingAPI('http://localhost')
|
||||||
|
|
||||||
# Compare the results, we only care now that we got 2 of them not the content
|
# Compare the results, we only care now that we got 2 of them not the content
|
||||||
self.assertEqual(package_info,
|
self.assertEqual(package_info,
|
||||||
@ -217,7 +217,7 @@ class TestApiCalls(unittest.TestCase):
|
|||||||
# Here place all mockable functions
|
# Here place all mockable functions
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def mock_generate_ring_packages():
|
def mock_generate_ring_packages():
|
||||||
with mock.patch('oscs.StagingApi._generate_ring_packages', return_value={
|
with mock.patch('oscs.StagingAPI._generate_ring_packages', return_value={
|
||||||
'elem-ring-0': 'openSUSE:Factory:Rings:0-Bootstrap',
|
'elem-ring-0': 'openSUSE:Factory:Rings:0-Bootstrap',
|
||||||
'elem-ring-1': 'openSUSE:Factory:Rings:1-MinimalX'}):
|
'elem-ring-1': 'openSUSE:Factory:Rings:1-MinimalX'}):
|
||||||
yield
|
yield
|
||||||
|
Loading…
x
Reference in New Issue
Block a user