zenoss/zenoss-prodbin — pull request #518 by iancmcc (2014-10-21 20:00:04+00:00)
Title: Rewrite primaryAq so zport isn't hardcoded.

Chipping away at https://jira.zenoss.com/browse/ZEN-9113

Before:
```
$ zendev test -d -- Products.ZenRelations
starting...
Waiting for zeneventserver to start......
==============================

Packages to be tested:
Products.ZenRelations

==============================
Parsing /opt/zenoss/etc/zope.conf
Running tests at level 1
Running Products.ZenRelations.tests.testEvents.EventLayer tests:
Set up Testing.ZopeTestCase.layer.ZopeLite in 0.205 seconds.
Set up Products.ZenRelations.tests.testEvents.EventLayer2014-10-21 20:55:58 WARNING zen.zenpacklib ZenPacks.zenoss.ControlCenter: Pool custom columns exceed 750 pixels (778)
Error 111 connecting localhost:6379. Connection refused.
2014-10-21 20:55:58 WARNING ZenUtils.ZopeRequestLogger ERROR connecting to redis. redis URL: redis://localhost:6379/0
2014-10-21 20:55:58 WARNING ZenUtils.ZopeRequestLogger Please check the redis-url value in global.conf
in 2.569 seconds.
Running:
...
Ran 3 tests with 0 failures and 0 errors in 1.080 seconds.
Running Products.ZenTestCase.BaseTestCase.ZenossTestCaseLayer tests:
Tear down Products.ZenRelations.tests.testEvents.EventLayer in 0.001 seconds.
Set up Products.ZenTestCase.BaseTestCase.ZenossTestCaseLayer in 0.002 seconds.
Running:
..........

Error in test testCutPasteRM2 (Products.ZenRelations.tests.testFullZopeZenRelations.FullZopeTestCases)
Traceback (most recent call last):
File "/usr/lib64/python2.7/unittest/case.py", line 369, in run
testMethod()
File "/opt/zenoss/Products/ZenRelations/tests/testFullZopeZenRelations.py", line 62, in testCutPasteRM2
self.failUnless(eth0.getPrimaryUrlPath().find(
File "/opt/zenoss/Products/ZenRelations/PrimaryPathObjectManager.py", line 67, in getPrimaryUrlPath
objaq = self.primaryAq()
File "/opt/zenoss/Products/ZenRelations/PrimaryPathObjectManager.py", line 79, in primaryAq
return aq_base(self).__of__(parent.primaryAq())
File "/opt/zenoss/Products/ZenRelations/PrimaryPathObjectManager.py", line 79, in primaryAq
return aq_base(self).__of__(parent.primaryAq())
File "/opt/zenoss/Products/ZenRelations/PrimaryPathObjectManager.py", line 79, in primaryAq
return aq_base(self).__of__(parent.primaryAq())
File "/opt/zenoss/Products/ZenRelations/PrimaryPathObjectManager.py", line 79, in primaryAq
return aq_base(self).__of__(parent.primaryAq())
File "/opt/zenoss/Products/ZenRelations/PrimaryPathObjectManager.py", line 75, in primaryAq
base = self.getPhysicalRoot().zport
AttributeError: zport

..................................................................................................................
Ran 124 tests with 0 failures and 1 errors in 1 minutes 5.240 seconds.
Tearing down left over layers:
Tear down Products.ZenTestCase.BaseTestCase.ZenossTestCaseLayer in 0.000 seconds.
Tear down Testing.ZopeTestCase.layer.ZopeLite in 0.000 seconds.

Tests with errors:
testCutPasteRM2 (Products.ZenRelations.tests.testFullZopeZenRelations.FullZopeTestCases)
Total: 127 tests, 0 failures, 1 errors in 1 minutes 9.640 seconds.
Some tests failed.
```

After:
```
$ zendev test -d -- Products.ZenRelations
starting...
Waiting for zeneventserver to start......
==============================

Packages to be tested:
Products.ZenRelations

==============================
Parsing /opt/zenoss/etc/zope.conf
Running tests at level 1
Running Products.ZenRelations.tests.testEvents.EventLayer tests:
Set up Testing.ZopeTestCase.layer.ZopeLite in 0.209 seconds.
Set up Products.ZenRelations.tests.testEvents.EventLayer2014-10-21 20:50:16 WARNING zen.zenpacklib ZenPacks.zenoss.ControlCenter: Pool custom columns exceed 750 pixels
(778)
Error 111 connecting localhost:6379. Connection refused.
2014-10-21 20:50:16 WARNING ZenUtils.ZopeRequestLogger ERROR connecting to redis. redis URL: redis://localhost:6379/0
2014-10-21 20:50:16 WARNING ZenUtils.ZopeRequestLogger Please check the redis-url value in global.conf
in 2.511 seconds.
Running:
...
Ran 3 tests with 0 failures and 0 errors in 1.097 seconds.
Running Products.ZenTestCase.BaseTestCase.ZenossTestCaseLayer tests:
Tear down Products.ZenRelations.tests.testEvents.EventLayer in 0.001 seconds.
Set up Products.ZenTestCase.BaseTestCase.ZenossTestCaseLayer in 0.002 seconds.
Running:
............................................................................................................................
Ran 124 tests with 0 failures and 0 errors in 1 minutes 5.462 seconds.
Tearing down left over layers:
Tear down Products.ZenTestCase.BaseTestCase.ZenossTestCaseLayer in 0.000 seconds.
Tear down Testing.ZopeTestCase.layer.ZopeLite in 0.000 seconds.
Total: 127 tests, 0 failures, 0 errors in 1 minutes 9.828 seconds.
```