updated tests to use poppy

This commit is contained in:
amitgandhinz 2014-08-07 13:16:46 -04:00
parent d4030bb1c6
commit 31906801f8
41 changed files with 148 additions and 151 deletions

View File

@ -1,5 +1,5 @@
[run] [run]
omit = *cdn/openstack* omit = *poppy/openstack*
[report] [report]
exclude_lines = exclude_lines =

View File

@ -86,7 +86,7 @@ Template::
\n \n
{{third-party lib imports in human alphabetical order}} {{third-party lib imports in human alphabetical order}}
\n \n
{{cdn imports in human alphabetical order}} {{poppy imports in human alphabetical order}}
\n \n
\n \n
{{begin your code}} {{begin your code}}
@ -102,9 +102,9 @@ Example::
import eventlet import eventlet
import cdn.common import poppy.common
from cdn import test from poppy import test
import cdn.storage.cassandra import poppy.storage.cassandra
More Import Examples More Import Examples
@ -112,11 +112,11 @@ More Import Examples
**INCORRECT** :: **INCORRECT** ::
import cdn.transport.wsgi as wsgi import poppy.transport.wsgi as wsgi
**CORRECT** :: **CORRECT** ::
from cdn.transport import wsgi from poppy.transport import wsgi
Docstrings Docstrings
---------- ----------

View File

@ -1,16 +1,16 @@
CDN Poppy
======= =======
Content Delivery Network Management as a Service CDN Provider Management as a Service
Note: This is a work in progress and is not currently recommended for production use. Note: This is a work in progress and is not currently recommended for production use.
What is CDN What is Poppy
============ ============
Users have come to expect exceptional speed in their applications, websites, and video experiences. Because of this, using a CDN has become standard for companies, no matter their size. Users have come to expect exceptional speed in their applications, websites, and video experiences. Because of this, using a CDN has become standard for companies, no matter their size.
CDN will take all the guess work out of the CDN market for our users. CDN will give them a consistently speedy experience from integrated partners, with an easy to use RESTful API. Poppy will take all the guess work out of the CDN market for our users. Poppy will give them a consistently speedy experience from integrated partners, with an easy to use RESTful API.
Vendor lock-in to a particular CDN provider is removed by abstracting away the plethora of vendor API's available. This means that a customer only has to integrate with one CDN API, and reap the benefits of using multiple providers. Vendor lock-in to a particular CDN provider is removed by abstracting away the plethora of vendor API's available. This means that a customer only has to integrate with one CDN API, and reap the benefits of using multiple providers.
@ -39,10 +39,10 @@ Features
+ Set Restrictions on who can access cached content + Set Restrictions on who can access cached content
What CDN is not What Poppy is not
---------------------- ----------------------
CDN does not run its own Edge Cache or POP servers. This is purely a management API to abstract away the myriad of CDN providers on the market. Poppy does not run its own Edge Cache or POP servers. This is purely a management API to abstract away the myriad of CDN providers on the market.
@ -53,38 +53,38 @@ Getting Started
not all of these steps are required. It is assumed you have `CassandraDB` not all of these steps are required. It is assumed you have `CassandraDB`
installed and running. installed and running.
1. From your home folder create the ``~/.cdn`` folder and clone the repo:: 1. From your home folder create the ``~/.poppy`` folder and clone the repo::
$ cd $ cd
$ mkdir .cdn $ mkdir .cdn
$ git clone https://github.com/rackerlabs/cdn.git $ git clone https://github.com/rackerlabs/cdn.git
2. Copy the CDN config files to the directory ``~/.cdn``:: 2. Copy the Poppy config files to the directory ``~/.poppy``::
$ cp cdn/etc/cdn.conf ~/.cdn/cdn.conf $ cp poppy/etc/cdn.conf ~/.poppy/poppy.conf
$ cp cdn/etc/logging.conf ~/.cdn/logging.conf $ cp poppy/etc/logging.conf ~/.poppy/logging.conf
3. Find the ``[drivers:storage:cassandradb]`` section in 3. Find the ``[drivers:storage:cassandradb]`` section in
``~/.cdn/cdn.conf`` and modify the URI to point ``~/.poppy/poppy.conf`` and modify the URI to point
to your local casssandra cluster:: to your local casssandra cluster::
[drivers:storage:cassandra] [drivers:storage:cassandra]
cluster = "localhost" cluster = "localhost"
keyspace = cdn keyspace = poppy
4. By using cassandra storage plugin, you will need to create the default 4. By using cassandra storage plugin, you will need to create the default
keyspace "cdn" on your cassandra host/cluster. So log into cqlsh, do:: keyspace "cdn" on your cassandra host/cluster. So log into cqlsh, do::
cqlsh> CREATE KEYSPACE cdn WITH REPLICATION = { 'class' : 'SimpleStrategy' , 'replication_factor' : 1} ; cqlsh> CREATE KEYSPACE poppy WITH REPLICATION = { 'class' : 'SimpleStrategy' , 'replication_factor' : 1} ;
5. For logging, find the ``[DEFAULT]`` section in 5. For logging, find the ``[DEFAULT]`` section in
``~/.cdn/cdn.conf`` and modify as desired:: ``~/.poppy/poppy.conf`` and modify as desired::
log_file = server.log log_file = server.log
6. Change directories back to your local copy of the repo:: 6. Change directories back to your local copy of the repo::
$ cd cdn $ cd poppy
7. Install general requirements:: 7. Install general requirements::
@ -93,7 +93,7 @@ installed and running.
Install Requirements for each Provider configured:: Install Requirements for each Provider configured::
$ pip install -r cdn/providers/fastly/requirements.txt $ pip install -r poppy/providers/fastly/requirements.txt
Run the following so you can see the results of any changes you Run the following so you can see the results of any changes you
make to the code without having to reinstall the package each time:: make to the code without having to reinstall the package each time::
@ -101,14 +101,11 @@ installed and running.
$ pip install -e . $ pip install -e .
Installing the fastly client library may have issues. Copy the `README.md` file to `README` and try again. 8. Start the Poppy server::
$ poppy-server
8. Start the CDN server:: 9. Test out that Poppy is working by requesting the home doc (with a sample project ID)::
$ cdn-server
9. Test out that CDN is working by requesting the home doc (with a sample project ID)::
$ curl -i -X GET http://0.0.0.0:8888/v1.0/123 $ curl -i -X GET http://0.0.0.0:8888/v1.0/123
@ -143,7 +140,7 @@ Mac OSX
3. Create a Keyspace with Replication:: 3. Create a Keyspace with Replication::
CREATE KEYSPACE cdn WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; CREATE KEYSPACE poppy WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
4. Import the Cassandra Schema to set up the required tables that CDN will need:: 4. Import the Cassandra Schema to set up the required tables that CDN will need::
@ -160,7 +157,7 @@ First install the additional requirements::
And then run tests:: And then run tests::
$ tox -e py27 $ tox
.. _`CassandraDB` : http://cassandra.apache.org .. _`CassandraDB` : http://cassandra.apache.org

View File

@ -1,11 +1,11 @@
## ##
## CDN API ## Poppy
## ##
## ##
# The following files should exist in this folder before running Dockerfile # The following files should exist in this folder before running Dockerfile
# - docker_rsa (private key) -> public key should be published to the private git repo # - docker_rsa (private key) -> public key should be published to the private git repo
# - cdn.conf (desired configuration for cdn api) # - poppy.conf (desired configuration for poppy api)
# - logging.conf (desired logging configuration file) # - logging.conf (desired logging configuration file)
@ -43,28 +43,28 @@ RUN echo "IdentityFile ~/.ssh/id_rsa" >> /etc/ssh/ssh_config
RUN touch /root/.ssh/known_hosts RUN touch /root/.ssh/known_hosts
# Pull project # Pull project
RUN git clone git@github.com:rackerlabs/cdn /home/cdn RUN git clone git@github.com:rackerlabs/cdn /home/poppy
# Install Requirements # Install Requirements
RUN sudo pip install -r /home/cdn/requirements/requirements.txt RUN sudo pip install -r /home/poppy/requirements/requirements.txt
RUN sudo pip install -e /home/cdn/. RUN sudo pip install -e /home/poppy/.
# Set up the configuration files # Set up the configuration files
ADD ./cdn.conf /etc/cdn.conf ADD ./poppy.conf /etc/poppy.conf
ADD ./logging.conf /etc/logging.conf ADD ./logging.conf /etc/logging.conf
ADD ./uwsgi.ini /root/uwsgi.ini ADD ./uwsgi.ini /root/uwsgi.ini
# create uwsgi log directory # create uwsgi log directory
RUN mkdir -p /var/log/cdn RUN mkdir -p /var/log/poppy
RUN chmod -R +w /var/log/cdn RUN chmod -R +w /var/log/poppy
# create uwsgi pid directory # create uwsgi pid directory
RUN mkdir -p /var/run/cdn RUN mkdir -p /var/run/poppy
RUN chmod -R +w /var/run/cdn RUN chmod -R +w /var/run/poppy
#RUN /usr/local/bin/uwsgi --ini /root/uwsgi.ini #RUN /usr/local/bin/uwsgi --ini /root/uwsgi.ini
# Start CDN # Start Poppy
EXPOSE 80 EXPOSE 80
CMD ["/usr/local/bin/uwsgi", "--ini", "/root/uwsgi.ini"] CMD ["/usr/local/bin/uwsgi", "--ini", "/root/uwsgi.ini"]

View File

@ -1,6 +1,6 @@
# By default, this should live in one of: # By default, this should live in one of:
# ~/.cdn/cdn.conf # ~/.poppy/poppy.conf
# /etc/cdn/cdn.conf # /etc/poppy/poppy.conf
[DEFAULT] [DEFAULT]
# Show more verbose log output (sets INFO log level output) # Show more verbose log output (sets INFO log level output)
@ -10,7 +10,7 @@
;debug = False ;debug = False
# Log to this file # Log to this file
log_file = cdn.log log_file = poppy.log
;auth_strategy = ;auth_strategy =
@ -40,14 +40,14 @@ port = 8888
[drivers:storage:mongodb] [drivers:storage:mongodb]
uri = mongodb://localhost uri = mongodb://localhost
database = cdn database = poppy
[drivers:storage:cassandra] [drivers:storage:cassandra]
cluster = "<your-cassandra-server-link-name>" cluster = "<your-cassandra-server-link-name>"
keyspace = cdn keyspace = poppy
[drivers:storage:mockdb] [drivers:storage:mockdb]
database = cdn database = poppy
[drivers:provider:fastly] [drivers:provider:fastly]
apikey = "<MYAPIKEY>" apikey = "<MYAPIKEY>"

View File

@ -14,12 +14,12 @@ handlers=devel
[logger_server] [logger_server]
level=DEBUG level=DEBUG
handlers=devel handlers=devel
qualname=cdn-server qualname=poppy-server
[logger_combined] [logger_combined]
level=DEBUG level=DEBUG
handlers=devel handlers=devel
qualname=cdn-combined qualname=poppy-combined
[handler_production] [handler_production]
class=handlers.SysLogHandler class=handlers.SysLogHandler
@ -31,7 +31,7 @@ args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER)
class=FileHandler class=FileHandler
level=DEBUG level=DEBUG
formatter=normal_with_name formatter=normal_with_name
args=('cdn.log', 'w') args=('poppy.log', 'w')
[handler_devel] [handler_devel]
class=StreamHandler class=StreamHandler

View File

@ -1,14 +1,14 @@
[uwsgi] [uwsgi]
master = true master = true
chdir = /home/cdn/ chdir = /home/poppy/
workers = 4 workers = 4
http-socket = 0.0.0.0:80 http-socket = 0.0.0.0:80
logger = file:/var/log/cdn/cdn.log logger = file:/var/log/poppy/poppy.log
pidfile = /var/run/cdn/cdn.pid pidfile = /var/run/poppy/poppy.pid
die-on-term = true die-on-term = true
enable-threads = true enable-threads = true
buffer-size = 32768 buffer-size = 32768
max-requests = 15000 max-requests = 15000
no-orphans = true no-orphans = true
vacuum = true vacuum = true
module = cdn.transport.falcon.app:app module = poppy.transport.falcon.app:app

View File

@ -29,7 +29,7 @@ source-dir = doc/source
[entry_points] [entry_points]
console_scripts = console_scripts =
cdn-server = poppy.cmd.server:run poppy-server = poppy.cmd.server:run
cdn.transport = cdn.transport =
falcon = poppy.transport.falcon:Driver falcon = poppy.transport.falcon:Driver

View File

@ -4,7 +4,7 @@ API Tests
The API tests The API tests
+ test an actual API against a running environment. + test an actual API against a running environment.
+ are black box tests + are black box tests
+ can be used to test any running instance of cdn server (dev, test, prod, local + can be used to test any running instance of poppy server (dev, test, prod, local
instance, containerized instance) instance, containerized instance)
@ -17,13 +17,13 @@ To run the tests
2. Set the following environment variables:: 2. Set the following environment variables::
export CAFE_CONFIG_FILE_PATH=~/.cdn/tests.conf export CAFE_CONFIG_FILE_PATH=~/.poppy/tests.conf
export CAFE_ROOT_LOG_PATH=~/.cdn/logs export CAFE_ROOT_LOG_PATH=~/.poppy/logs
export CAFE_TEST_LOG_PATH=~/.cdn/logs export CAFE_TEST_LOG_PATH=~/.poppy/logs
3. Copy the api.conf file to the path set by CAFE_CONFIG_FILE_PATH:: 3. Copy the api.conf file to the path set by CAFE_CONFIG_FILE_PATH::
cp tests/etc/api.conf ~/.cdn/tests.conf cp tests/etc/api.conf ~/.poppy/tests.conf
4. Once you are ready to run the tests:: 4. Once you are ready to run the tests::

View File

@ -36,7 +36,7 @@ class TestBase(fixtures.BaseTestFixture):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
cls.conf_file = 'cdn_mockdb.conf' cls.conf_file = 'poppy_mockdb.conf'
super(TestBase, cls).setUpClass() super(TestBase, cls).setUpClass()
@ -56,14 +56,14 @@ class TestBase(fixtures.BaseTestFixture):
cls.server_config = config.CDNServerConfig() cls.server_config = config.CDNServerConfig()
if cls.server_config.run_server: if cls.server_config.run_server:
conf_path = os.environ["CDN_TESTS_CONFIGS_DIR"] conf_path = os.environ["POPPY_TESTS_CONFIGS_DIR"]
config_file = os.path.join(conf_path, cls.conf_file) config_file = os.path.join(conf_path, cls.conf_file)
conf = cfg.ConfigOpts() conf = cfg.ConfigOpts()
conf(project='cdn', prog='cdn', args=[], conf(project='poppy', prog='poppy', args=[],
default_config_files=[config_file]) default_config_files=[config_file])
cdn_server = server.CDNServer() poppy_server = server.CDNServer()
cdn_server.start(conf) poppy_server.start(conf)
def assertSchema(self, response_json, expected_schema): def assertSchema(self, response_json, expected_schema):
"""Verify response schema aligns with the expected schema.""" """Verify response schema aligns with the expected schema."""

View File

@ -16,23 +16,23 @@
from cafe.engine.models import data_interfaces from cafe.engine.models import data_interfaces
class CDNConfig(data_interfaces.ConfigSectionInterface): class PoppyConfig(data_interfaces.ConfigSectionInterface):
"""Defines the config values for cdn.""" """Defines the config values for poppy."""
SECTION_NAME = 'cdn' SECTION_NAME = 'poppy'
@property @property
def base_url(self): def base_url(self):
"""CDN endpoint.""" """poppy endpoint."""
return self.get('base_url') return self.get('base_url')
class CDNServerConfig(data_interfaces.ConfigSectionInterface): class PoppyServerConfig(data_interfaces.ConfigSectionInterface):
"""Defines the config values for starting (or not) a cdn server""" """Defines the config values for starting (or not) a poppy server"""
SECTION_NAME = 'cdn_server' SECTION_NAME = 'poppy_server'
@property @property
def run_server(self): def run_server(self):
"""Boolean value indicating whether to start CDN server.""" """Boolean value indicating whether to start poppy server."""
return self.get_boolean('run_server') return self.get_boolean('run_server')

View File

@ -17,13 +17,13 @@ import abc
import multiprocessing import multiprocessing
import six import six
from cdn import bootstrap from poppy import bootstrap
@six.add_metaclass(abc.ABCMeta) @six.add_metaclass(abc.ABCMeta)
class Server(object): class Server(object):
name = "cdn-server" name = "poppy-server"
def __init__(self): def __init__(self):
self.process = None self.process = None
@ -88,7 +88,7 @@ class Server(object):
class CDNServer(Server): class CDNServer(Server):
name = "cdn-server" name = "poppy-server"
def get_target(self, conf): def get_target(self, conf):
server = bootstrap.Bootstrap(conf) server = bootstrap.Bootstrap(conf)

View File

@ -33,7 +33,7 @@ class TestCase(testtools.TestCase):
def setUp(self): def setUp(self):
super(TestCase, self).setUp() super(TestCase, self).setUp()
self.useFixture(fixtures.FakeLogger('cdn')) self.useFixture(fixtures.FakeLogger('poppy'))
if self.config_file: if self.config_file:
self.conf = self.load_conf(self.config_file) self.conf = self.load_conf(self.config_file)

View File

@ -7,8 +7,8 @@ username={user name of the cloud account}
api_key={api key for this user name} api_key={api key for this user name}
base_url=https://identity.api.rackspacecloud.com/v2.0 base_url=https://identity.api.rackspacecloud.com/v2.0
[cdn] [poppy]
base_url=https//0.0.0.0:8888 base_url=https//0.0.0.0:8888
[cdn_server] [poppy_server]
run_server=True run_server=True

View File

@ -1,6 +1,6 @@
# By default, this should live in one of: # By default, this should live in one of:
# ~/.cdn/cdn.conf # ~/.poppy/poppy.conf
# /etc/cdn/cdn.conf # /etc/poppy/poppy.conf
[DEFAULT] [DEFAULT]
# Show more verbose log output (sets INFO log level output) # Show more verbose log output (sets INFO log level output)
@ -10,7 +10,7 @@
;debug = False ;debug = False
# Log to this file # Log to this file
log_file = cdn.log log_file = poppy.log
;auth_strategy = ;auth_strategy =
@ -42,14 +42,14 @@ port = 8888
[drivers:storage:mongodb] [drivers:storage:mongodb]
uri = mongodb://localhost uri = mongodb://localhost
database = cdn database = poppy
[drivers:storage:cassandra] [drivers:storage:cassandra]
cluster = "localhost" cluster = "localhost"
keyspace = cdn keyspace = poppy
[drivers:storage:mockdb] [drivers:storage:mockdb]
database = cdn database = poppy
[drivers:provider:fastly] [drivers:provider:fastly]
apikey = "MYAPIKEY" apikey = "MYAPIKEY"

View File

@ -1,6 +1,6 @@
# By default, this should live in one of: # By default, this should live in one of:
# ~/.cdn/cdn.conf # ~/.poppy/poppy.conf
# /etc/cdn/cdn.conf # /etc/poppy/poppy.conf
[DEFAULT] [DEFAULT]
# Show more verbose log output (sets INFO log level output) # Show more verbose log output (sets INFO log level output)
@ -10,7 +10,7 @@
;debug = False ;debug = False
# Log to this file # Log to this file
log_file = cdn.log log_file = poppy.log
# ================= Syslog Options ============================ # ================= Syslog Options ============================
@ -40,14 +40,14 @@ port = 8888
[drivers:storage:mongodb] [drivers:storage:mongodb]
uri = mongodb://localhost uri = mongodb://localhost
database = cdn database = poppy
[drivers:storage:cassandra] [drivers:storage:cassandra]
cluster = "localhost" cluster = "localhost"
keyspace = cdn keyspace = poppy
[drivers:storage:mockdb] [drivers:storage:mockdb]
database = cdn database = poppy
[drivers:provider:fastly] [drivers:provider:fastly]
apikey = "MYAPIKEY" apikey = "MYAPIKEY"

View File

@ -18,7 +18,7 @@ import os
from oslo.config import cfg from oslo.config import cfg
import webtest import webtest
from cdn import bootstrap from poppy import bootstrap
from tests.functional import base from tests.functional import base
@ -33,9 +33,9 @@ class BaseFunctionalTest(base.TestCase):
)))) ))))
conf_path = os.path.join(tests_path, 'etc', 'default_functional.conf') conf_path = os.path.join(tests_path, 'etc', 'default_functional.conf')
cfg.CONF(args=[], default_config_files=[conf_path]) cfg.CONF(args=[], default_config_files=[conf_path])
cdn_wsgi = bootstrap.Bootstrap(cfg.CONF).transport.app poppy_wsgi = bootstrap.Bootstrap(cfg.CONF).transport.app
self.app = webtest.TestApp(cdn_wsgi) self.app = webtest.TestApp(poppy_wsgi)
FunctionalTest = BaseFunctionalTest FunctionalTest = BaseFunctionalTest

View File

@ -18,7 +18,7 @@ import json
import pecan import pecan
from webtest import app from webtest import app
from cdn.transport.pecan.controllers import base as c_base from poppy.transport.pecan.controllers import base as c_base
from tests.functional.transport.pecan import base from tests.functional.transport.pecan import base

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from cdn.manager.default import v1 from poppy.manager.default import v1
from tests.functional.transport.pecan import base from tests.functional.transport.pecan import base

View File

@ -15,7 +15,7 @@
import uuid import uuid
from cdn.manager.default import v1 from poppy.manager.default import v1
from tests.functional.transport.pecan import base from tests.functional.transport.pecan import base

View File

@ -22,13 +22,13 @@ import sys
import pecan import pecan
from webtest import app from webtest import app
from cdn.common import errors from poppy.common import errors
from cdn.transport.validators import helpers from poppy.transport.validators import helpers
from cdn.transport.validators.schemas import service from poppy.transport.validators.schemas import service
from cdn.transport.validators.stoplight import decorators from poppy.transport.validators.stoplight import decorators
from cdn.transport.validators.stoplight import exceptions from poppy.transport.validators.stoplight import exceptions
from cdn.transport.validators.stoplight import helpers as stoplight_helpers from poppy.transport.validators.stoplight import helpers as stoplight_helpers
from cdn.transport.validators.stoplight import rule from poppy.transport.validators.stoplight import rule
from tests.functional import base from tests.functional import base
# for pecan testing app # for pecan testing app

View File

@ -13,9 +13,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from cdn.transport.validators.stoplight import decorators from poppy.transport.validators.stoplight import decorators
from cdn.transport.validators.stoplight import exceptions from poppy.transport.validators.stoplight import exceptions
from cdn.transport.validators.stoplight import rule from poppy.transport.validators.stoplight import rule
from test_service_validation import BaseTestCase from test_service_validation import BaseTestCase
# TODO(tonytan4ever): We probably want to move this to a # TODO(tonytan4ever): We probably want to move this to a

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from cdn.common import decorators from poppy.common import decorators
from tests.unit import base from tests.unit import base

View File

@ -17,14 +17,14 @@ import mock
from oslo.config import cfg from oslo.config import cfg
from cdn.manager.default import driver from poppy.manager.default import driver
from cdn.manager.default import services from poppy.manager.default import services
from tests.unit import base from tests.unit import base
class DefaultManagerDriverTests(base.TestCase): class DefaultManagerDriverTests(base.TestCase):
@mock.patch('cdn.storage.base.driver.StorageDriverBase') @mock.patch('poppy.storage.base.driver.StorageDriverBase')
@mock.patch('cdn.provider.base.driver.ProviderDriverBase') @mock.patch('poppy.provider.base.driver.ProviderDriverBase')
def setUp(self, mock_storage, mock_provider): def setUp(self, mock_storage, mock_provider):
super(DefaultManagerDriverTests, self).setUp() super(DefaultManagerDriverTests, self).setUp()

View File

@ -17,14 +17,14 @@ import mock
from oslo.config import cfg from oslo.config import cfg
from cdn.manager.default import driver from poppy.manager.default import driver
from cdn.manager.default import services from poppy.manager.default import services
from tests.unit import base from tests.unit import base
class DefaultManagerServiceTests(base.TestCase): class DefaultManagerServiceTests(base.TestCase):
@mock.patch('cdn.storage.base.driver.StorageDriverBase') @mock.patch('poppy.storage.base.driver.StorageDriverBase')
@mock.patch('cdn.provider.base.driver.ProviderDriverBase') @mock.patch('poppy.provider.base.driver.ProviderDriverBase')
def setUp(self, mock_driver, mock_provider): def setUp(self, mock_driver, mock_provider):
super(DefaultManagerServiceTests, self).setUp() super(DefaultManagerServiceTests, self).setUp()

View File

@ -16,7 +16,7 @@
import ddt import ddt
from cdn.model.helpers import cachingrule from poppy.model.helpers import cachingrule
from tests.unit import base from tests.unit import base

View File

@ -16,7 +16,7 @@
import ddt import ddt
from cdn.model.helpers import domain from poppy.model.helpers import domain
from tests.unit import base from tests.unit import base

View File

@ -16,7 +16,7 @@
import ddt import ddt
from cdn.model.helpers import link from poppy.model.helpers import link
from tests.unit import base from tests.unit import base

View File

@ -16,7 +16,7 @@
import ddt import ddt
from cdn.model.helpers import origin from poppy.model.helpers import origin
from tests.unit import base from tests.unit import base

View File

@ -16,7 +16,7 @@
import ddt import ddt
from cdn.model.helpers import restriction from poppy.model.helpers import restriction
from tests.unit import base from tests.unit import base

View File

@ -16,7 +16,7 @@
import ddt import ddt
from cdn.model.helpers import rule from poppy.model.helpers import rule
from tests.unit import base from tests.unit import base

View File

@ -16,9 +16,9 @@
import ddt import ddt
from cdn.model.helpers import domain from poppy.model.helpers import domain
from cdn.model.helpers import origin from poppy.model.helpers import origin
from cdn.model import service from poppy.model import service
from tests.unit import base from tests.unit import base

View File

@ -16,7 +16,7 @@
import fastly import fastly
import mock import mock
from cdn.provider.fastly import driver from poppy.provider.fastly import driver
from oslo.config import cfg from oslo.config import cfg
from tests.unit import base from tests.unit import base
@ -55,7 +55,7 @@ class TestDriver(base.TestCase):
client = provider.client() client = provider.client()
self.assertNotEquals(client, None) self.assertNotEquals(client, None)
@mock.patch('cdn.provider.fastly.controllers.ServiceController') @mock.patch('poppy.provider.fastly.controllers.ServiceController')
@mock.patch.object(driver, 'FASTLY_OPTIONS', new=FASTLY_OPTIONS) @mock.patch.object(driver, 'FASTLY_OPTIONS', new=FASTLY_OPTIONS)
def test_service_controller(self, MockController): def test_service_controller(self, MockController):
provider = driver.CDNProvider(self.conf) provider = driver.CDNProvider(self.conf)

View File

@ -18,7 +18,7 @@ import fastly
import mock import mock
import random import random
from cdn.provider.fastly import services from poppy.provider.fastly import services
from tests.unit import base from tests.unit import base
@ -29,8 +29,8 @@ class TestServices(base.TestCase):
@mock.patch('fastly.FastlyConnection') @mock.patch('fastly.FastlyConnection')
@mock.patch('fastly.FastlyService') @mock.patch('fastly.FastlyService')
@mock.patch('fastly.FastlyVersion') @mock.patch('fastly.FastlyVersion')
@mock.patch('cdn.provider.fastly.services.ServiceController.client') @mock.patch('poppy.provider.fastly.services.ServiceController.client')
@mock.patch('cdn.provider.fastly.driver.CDNProvider') @mock.patch('poppy.provider.fastly.driver.CDNProvider')
def test_create(self, service_json, mock_connection, def test_create(self, service_json, mock_connection,
mock_service, mock_version, mock_controllerclient, mock_service, mock_version, mock_controllerclient,
mock_driver): mock_driver):
@ -122,8 +122,8 @@ class TestServices(base.TestCase):
@mock.patch('fastly.FastlyConnection') @mock.patch('fastly.FastlyConnection')
@mock.patch('fastly.FastlyService') @mock.patch('fastly.FastlyService')
@mock.patch('cdn.provider.fastly.services.ServiceController.client') @mock.patch('poppy.provider.fastly.services.ServiceController.client')
@mock.patch('cdn.provider.fastly.driver.CDNProvider') @mock.patch('poppy.provider.fastly.driver.CDNProvider')
def test_delete(self, mock_connection, mock_service, mock_client, def test_delete(self, mock_connection, mock_service, mock_client,
mock_driver): mock_driver):
driver = mock_driver() driver = mock_driver()
@ -155,8 +155,8 @@ class TestServices(base.TestCase):
controller.client.delete_service.assert_called_once_with(service.id) controller.client.delete_service.assert_called_once_with(service.id)
self.assertIn('domain', resp[driver.provider_name]) self.assertIn('domain', resp[driver.provider_name])
@mock.patch('cdn.provider.fastly.services.ServiceController.client') @mock.patch('poppy.provider.fastly.services.ServiceController.client')
@mock.patch('cdn.provider.fastly.driver.CDNProvider') @mock.patch('poppy.provider.fastly.driver.CDNProvider')
@ddt.file_data('data_service.json') @ddt.file_data('data_service.json')
def test_update(self, mock_get_client, mock_driver, service_json): def test_update(self, mock_get_client, mock_driver, service_json):
service_name = 'whatsitnamed' service_name = 'whatsitnamed'
@ -166,7 +166,7 @@ class TestServices(base.TestCase):
resp = controller.update(service_name, service_json) resp = controller.update(service_name, service_json)
self.assertIn('domain', resp[driver.provider_name]) self.assertIn('domain', resp[driver.provider_name])
@mock.patch('cdn.provider.fastly.driver.CDNProvider') @mock.patch('poppy.provider.fastly.driver.CDNProvider')
def test_client(self, mock_driver): def test_client(self, mock_driver):
driver = mock_driver() driver = mock_driver()
controller = services.ServiceController(driver) controller = services.ServiceController(driver)

View File

@ -15,7 +15,7 @@
from oslo.config import cfg from oslo.config import cfg
from cdn.provider.mock import driver from poppy.provider.mock import driver
from tests.unit import base from tests.unit import base

View File

@ -18,15 +18,15 @@ import mock
from oslo.config import cfg from oslo.config import cfg
from cdn.storage.cassandra import driver from poppy.storage.cassandra import driver
from cdn.storage.cassandra import services from poppy.storage.cassandra import services
from tests.unit import base from tests.unit import base
CASSANDRA_OPTIONS = [ CASSANDRA_OPTIONS = [
cfg.ListOpt('cluster', default='mock_ip', cfg.ListOpt('cluster', default='mock_ip',
help='Cassandra Cluster contact points'), help='Cassandra Cluster contact points'),
cfg.StrOpt('keyspace', default='mock_cdn', cfg.StrOpt('keyspace', default='mock_poppy',
help='Keyspace for all queries made in session'), help='Keyspace for all queries made in session'),
] ]
@ -44,7 +44,7 @@ class CassandraStorageServiceTests(base.TestCase):
self.assertEquals(self.cassandra_driver.cassandra_conf['cluster'], self.assertEquals(self.cassandra_driver.cassandra_conf['cluster'],
['mock_ip']) ['mock_ip'])
self.assertEquals(self.cassandra_driver.cassandra_conf.keyspace, self.assertEquals(self.cassandra_driver.cassandra_conf.keyspace,
'mock_cdn') 'mock_poppy')
def test_is_alive(self): def test_is_alive(self):
self.assertEquals(self.cassandra_driver.is_alive(), True) self.assertEquals(self.cassandra_driver.is_alive(), True)
@ -52,7 +52,7 @@ class CassandraStorageServiceTests(base.TestCase):
@mock.patch.object(cassandra.cluster.Cluster, 'connect') @mock.patch.object(cassandra.cluster.Cluster, 'connect')
def test_connection(self, mock_cluster): def test_connection(self, mock_cluster):
self.cassandra_driver.connection() self.cassandra_driver.connection()
mock_cluster.assert_called_with('mock_cdn') mock_cluster.assert_called_with('mock_poppy')
def test_service_controller(self): def test_service_controller(self):
sc = self.cassandra_driver.service_controller sc = self.cassandra_driver.service_controller
@ -64,4 +64,4 @@ class CassandraStorageServiceTests(base.TestCase):
@mock.patch.object(cassandra.cluster.Cluster, 'connect') @mock.patch.object(cassandra.cluster.Cluster, 'connect')
def test_service_database(self, mock_cluster): def test_service_database(self, mock_cluster):
self.cassandra_driver.service_database self.cassandra_driver.service_database
mock_cluster.assert_called_with('mock_cdn') mock_cluster.assert_called_with('mock_poppy')

View File

@ -19,8 +19,8 @@ import mock
from oslo.config import cfg from oslo.config import cfg
from cdn.storage.cassandra import driver from poppy.storage.cassandra import driver
from cdn.storage.cassandra import services from poppy.storage.cassandra import services
from tests.unit import base from tests.unit import base

View File

@ -15,7 +15,7 @@
from oslo.config import cfg from oslo.config import cfg
from cdn.storage.mockdb import driver from poppy.storage.mockdb import driver
from tests.unit import base from tests.unit import base

View File

@ -18,7 +18,7 @@ import os
import mock import mock
from oslo.config import cfg from oslo.config import cfg
from cdn import bootstrap from poppy import bootstrap
from tests.unit import base from tests.unit import base
@ -32,7 +32,7 @@ class TestBootStrap(base.TestCase):
bootstrap_obj = bootstrap.Bootstrap(cfg.CONF) bootstrap_obj = bootstrap.Bootstrap(cfg.CONF)
mock_path = 'cdn.transport.pecan.driver.simple_server' mock_path = 'poppy.transport.pecan.driver.simple_server'
with mock.patch(mock_path) as mocked_module: with mock.patch(mock_path) as mocked_module:
mock_server = mock.Mock() mock_server = mock.Mock()
mocked_module.make_server = mock.Mock(return_value=mock_server) mocked_module.make_server = mock.Mock(return_value=mock_server)

View File

@ -18,7 +18,7 @@ import os
import mock import mock
from oslo.config import cfg from oslo.config import cfg
from cdn.transport import pecan from poppy.transport import pecan
from tests.unit import base from tests.unit import base
@ -32,7 +32,7 @@ class PecanTransportDriverTest(base.TestCase):
conf_path = os.path.join(tests_path, 'etc', 'default_functional.conf') conf_path = os.path.join(tests_path, 'etc', 'default_functional.conf')
cfg.CONF(args=[], default_config_files=[conf_path]) cfg.CONF(args=[], default_config_files=[conf_path])
mock_path = 'cdn.transport.pecan.driver.simple_server' mock_path = 'poppy.transport.pecan.driver.simple_server'
with mock.patch(mock_path) as mocked_module: with mock.patch(mock_path) as mocked_module:
mock_server = mock.Mock() mock_server = mock.Mock()
mocked_module.make_server = mock.Mock(return_value=mock_server) mocked_module.make_server = mock.Mock(return_value=mock_server)

View File

@ -35,4 +35,4 @@ builtins = __CDN_SETUP__
exclude = .venv*,venv*,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*.egg,.update-venv exclude = .venv*,venv*,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*.egg,.update-venv
[hacking] [hacking]
import_exceptions = cdn.openstack.common.gettextutils._ import_exceptions = poppy.openstack.common.gettextutils._