Merge lp:~brian.curtin/ubuntuone-storage-protocol/get_cert_location-removal into lp:ubuntuone-storage-protocol
- get_cert_location-removal
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Brian Curtin |
Approved revision: | 169 |
Merged at revision: | 160 |
Proposed branch: | lp:~brian.curtin/ubuntuone-storage-protocol/get_cert_location-removal |
Merge into: | lp:ubuntuone-storage-protocol |
Diff against target: |
265 lines (+6/-153) 8 files modified
MANIFEST.in (+0/-1) data/UbuntuOne-Go_Daddy_CA.pem (+0/-29) data/UbuntuOne-Go_Daddy_Class_2_CA.pem (+0/-25) data/UbuntuOne-ValiCert_Class_2_VA.pem (+0/-18) run-tests.bat (+1/-1) setup.py (+0/-6) tests/test_context.py (+3/-45) ubuntuone/storageprotocol/context.py (+2/-28) |
To merge this branch: | bzr merge lp:~brian.curtin/ubuntuone-storage-protocol/get_cert_location-removal |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
dobey (community) | Approve | ||
Mike McCracken (community) | Approve | ||
Review via email: mp+165232@code.launchpad.net |
Commit message
- Remove get_cert_location because it is now implemented as get_cert_dir in ubuntu-sso-client
Description of the change
Now that get_cert_dir is implemented in ubuntu-sso-client, remove its implementation and tests from storageprotocol.
Mike McCracken (mikemc) : | # |
dobey (dobey) wrote : | # |
14 === modified file 'setup.py'
15 --- setup.py 2012-12-03 19:45:43 +0000
16 +++ setup.py 2013-05-22 21:39:27 +0000
17 @@ -26,7 +26,7 @@
18 from distutils.core import setup
19 from distutils.spawn import find_executable
20 from distutils.command import clean, build
21 -from ubuntuone.
22 +from ubuntu_sso.utils import get_cert_dir
23
24
25 class StorageProtocol
26 @@ -74,7 +74,7 @@
27 packages=
28 'ubuntuone.
29 extra_path=
30 - data_files=
31 + data_files=
32 ['data/
33 'data/UbuntuOne
34 'data/UbuntuOne
35
sso-client and storage-protocol can't both be installing the same files to the same place. These files will need to be removed from this tree, and not installed at all.
dobey (dobey) : | # |
dobey (dobey) : | # |
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~brian.curtin/ubuntuone-storage-protocol/get_cert_location-removal into lp:ubuntuone-storage-protocol failed. Below is the output from the failed tests.
running build
running build_py
creating build
creating build/lib.
creating build/lib.
copying ubuntuone/
creating build/lib.
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
Traceback (most recent call last):
File "/usr/bin/u1trial", line 40, in <module>
main()
File "/usr/lib/
suite = test_runner.
File "/usr/lib/
config[
File "/usr/lib/
module_suite = self._load_
File "/usr/lib/
module = __import__(modpath, None, None, [""])
File "/mnt/tarmac/
from ubuntuone.
File "/mnt/tarmac/
from ubuntu_sso.utils import get_cert_dir
ImportError: cannot import name get_cert_dir
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~brian.curtin/ubuntuone-storage-protocol/get_cert_location-removal into lp:ubuntuone-storage-protocol failed. Below is the output from the failed tests.
running build
running build_py
creating build
creating build/lib.
creating build/lib.
copying ubuntuone/
creating build/lib.
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
tests.test_hashes
ContentHashin
test_
test_
test_
test_
FactoriesTest
test_
test_
test_
test_
test_
test_
MagicHashingTests
test_
test_
test_
test_
test_
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~brian.curtin/ubuntuone-storage-protocol/get_cert_location-removal into lp:ubuntuone-storage-protocol failed. Below is the output from the failed tests.
running build
running build_py
creating build
creating build/lib.
creating build/lib.
copying ubuntuone/
creating build/lib.
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
tests.test_hashes
ContentHashin
test_
test_
test_
test_
FactoriesTest
test_
test_
test_
test_
test_
test_
MagicHashingTests
test_
test_
test_
test_
test_
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~brian.curtin/ubuntuone-storage-protocol/get_cert_location-removal into lp:ubuntuone-storage-protocol failed. Below is the output from the failed tests.
running build
running build_py
creating build
creating build/lib.
creating build/lib.
copying ubuntuone/
creating build/lib.
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
tests.test_hashes
ContentHashin
test_
test_
test_
test_
FactoriesTest
test_
test_
test_
test_
test_
test_
MagicHashingTests
test_
test_
test_
test_
test_
- 169. By Brian Curtin
-
lint...
Preview Diff
1 | === modified file 'MANIFEST.in' | |||
2 | --- MANIFEST.in 2012-03-29 20:28:09 +0000 | |||
3 | +++ MANIFEST.in 2013-05-28 14:43:22 +0000 | |||
4 | @@ -4,6 +4,5 @@ | |||
5 | 4 | include run-tests | 4 | include run-tests |
6 | 5 | include *.pth | 5 | include *.pth |
7 | 6 | recursive-include ubuntuone *.proto | 6 | recursive-include ubuntuone *.proto |
8 | 7 | recursive-include data *.pem | ||
9 | 8 | recursive-include samples *.py | 7 | recursive-include samples *.py |
10 | 9 | recursive-include tests *.py | 8 | recursive-include tests *.py |
11 | 10 | 9 | ||
12 | === removed directory 'data' | |||
13 | === removed file 'data/UbuntuOne-Go_Daddy_CA.pem' | |||
14 | --- data/UbuntuOne-Go_Daddy_CA.pem 2011-09-21 12:53:10 +0000 | |||
15 | +++ data/UbuntuOne-Go_Daddy_CA.pem 1970-01-01 00:00:00 +0000 | |||
16 | @@ -1,29 +0,0 @@ | |||
17 | 1 | -----BEGIN CERTIFICATE----- | ||
18 | 2 | MIIE3jCCA8agAwIBAgICAwEwDQYJKoZIhvcNAQEFBQAwYzELMAkGA1UEBhMCVVMx | ||
19 | 3 | ITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g | ||
20 | 4 | RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMTYw | ||
21 | 5 | MTU0MzdaFw0yNjExMTYwMTU0MzdaMIHKMQswCQYDVQQGEwJVUzEQMA4GA1UECBMH | ||
22 | 6 | QXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTEaMBgGA1UEChMRR29EYWRkeS5j | ||
23 | 7 | b20sIEluYy4xMzAxBgNVBAsTKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5j | ||
24 | 8 | b20vcmVwb3NpdG9yeTEwMC4GA1UEAxMnR28gRGFkZHkgU2VjdXJlIENlcnRpZmlj | ||
25 | 9 | YXRpb24gQXV0aG9yaXR5MREwDwYDVQQFEwgwNzk2OTI4NzCCASIwDQYJKoZIhvcN | ||
26 | 10 | AQEBBQADggEPADCCAQoCggEBAMQt1RWMnCZM7DI161+4WQFapmGBWTtwY6vj3D3H | ||
27 | 11 | KrjJM9N55DrtPDAjhI6zMBS2sofDPZVUBJ7fmd0LJR4h3mUpfjWoqVTr9vcyOdQm | ||
28 | 12 | VZWt7/v+WIbXnvQAjYwqDL1CBM6nPwT27oDyqu9SoWlm2r4arV3aLGbqGmu75RpR | ||
29 | 13 | SgAvSMeYddi5Kcju+GZtCpyz8/x4fKL4o/K1w/O5epHBp+YlLpyo7RJlbmr2EkRT | ||
30 | 14 | cDCVw5wrWCs9CHRK8r5RsL+H0EwnWGu1NcWdrxcx+AuP7q2BNgWJCJjPOq8lh8BJ | ||
31 | 15 | 6qf9Z/dFjpfMFDniNoW1fho3/Rb2cRGadDAW/hOUoz+EDU8CAwEAAaOCATIwggEu | ||
32 | 16 | MB0GA1UdDgQWBBT9rGEyk2xF1uLuhV+auud2mWjM5zAfBgNVHSMEGDAWgBTSxLDS | ||
33 | 17 | kdRMEXGzYcs9of7dqGrU4zASBgNVHRMBAf8ECDAGAQH/AgEAMDMGCCsGAQUFBwEB | ||
34 | 18 | BCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZ29kYWRkeS5jb20wRgYDVR0f | ||
35 | 19 | BD8wPTA7oDmgN4Y1aHR0cDovL2NlcnRpZmljYXRlcy5nb2RhZGR5LmNvbS9yZXBv | ||
36 | 20 | c2l0b3J5L2dkcm9vdC5jcmwwSwYDVR0gBEQwQjBABgRVHSAAMDgwNgYIKwYBBQUH | ||
37 | 21 | AgEWKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeTAO | ||
38 | 22 | BgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBANKGwOy9+aG2Z+5mC6IG | ||
39 | 23 | OgRQjhVyrEp0lVPLN8tESe8HkGsz2ZbwlFalEzAFPIUyIXvJxwqoJKSQ3kbTJSMU | ||
40 | 24 | A2fCENZvD117esyfxVgqwcSeIaha86ykRvOe5GPLL5CkKSkB2XIsKd83ASe8T+5o | ||
41 | 25 | 0yGPwLPk9Qnt0hCqU7S+8MxZC9Y7lhyVJEnfzuz9p0iRFEUOOjZv2kWzRaJBydTX | ||
42 | 26 | RE4+uXR21aITVSzGh6O1mawGhId/dQb8vxRMDsxuxN89txJx9OjxUUAiKEngHUuH | ||
43 | 27 | qDTMBqLdElrRhjZkAzVvb3du6/KFUJheqwNTrZEjYx8WnM25sgVjOuH0aBsXBTWV | ||
44 | 28 | U+4= | ||
45 | 29 | -----END CERTIFICATE----- | ||
46 | 30 | 0 | ||
47 | === removed file 'data/UbuntuOne-Go_Daddy_Class_2_CA.pem' | |||
48 | --- data/UbuntuOne-Go_Daddy_Class_2_CA.pem 2009-06-23 19:38:42 +0000 | |||
49 | +++ data/UbuntuOne-Go_Daddy_Class_2_CA.pem 1970-01-01 00:00:00 +0000 | |||
50 | @@ -1,25 +0,0 @@ | |||
51 | 1 | -----BEGIN CERTIFICATE----- | ||
52 | 2 | MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJV | ||
53 | 3 | UzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQL | ||
54 | 4 | EyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X | ||
55 | 5 | DTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMx | ||
56 | 6 | ITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMo | ||
57 | 7 | R28gRGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAw | ||
58 | 8 | DQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d | ||
59 | 9 | /+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9 | ||
60 | 10 | S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32qRe3H3I2 | ||
61 | 11 | TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVl | ||
62 | 12 | OARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFA | ||
63 | 13 | pMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44 | ||
64 | 14 | dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLEsNKR1EwRcbNh | ||
65 | 15 | yz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2oatTj | ||
66 | 16 | oWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdy | ||
67 | 17 | b3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj | ||
68 | 18 | YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEF | ||
69 | 19 | BQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYX | ||
70 | 20 | MP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt | ||
71 | 21 | I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheab | ||
72 | 22 | IZ0KbIIOqPjCDPoQHmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzr | ||
73 | 23 | Tia2cyvk0/ZM/iZx4mERdEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBD | ||
74 | 24 | pqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/bvZ8= | ||
75 | 25 | -----END CERTIFICATE----- | ||
76 | 26 | 0 | ||
77 | === removed file 'data/UbuntuOne-ValiCert_Class_2_VA.pem' | |||
78 | --- data/UbuntuOne-ValiCert_Class_2_VA.pem 2012-08-15 21:53:43 +0000 | |||
79 | +++ data/UbuntuOne-ValiCert_Class_2_VA.pem 1970-01-01 00:00:00 +0000 | |||
80 | @@ -1,18 +0,0 @@ | |||
81 | 1 | -----BEGIN CERTIFICATE----- | ||
82 | 2 | MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0 | ||
83 | 3 | IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAz | ||
84 | 4 | BgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9y | ||
85 | 5 | aXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG | ||
86 | 6 | 9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAwMTk1NFoXDTE5MDYy | ||
87 | 7 | NjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29y | ||
88 | 8 | azEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs | ||
89 | 9 | YXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRw | ||
90 | 10 | Oi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNl | ||
91 | 11 | cnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOOnHK5avIWZJV16vY | ||
92 | 12 | dA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVCCSRrCl6zfN1SLUzm1NZ9 | ||
93 | 13 | WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwbP7RfZHM047QS | ||
94 | 14 | v4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADt/UG9v | ||
95 | 15 | UJSZSWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQC1u+mNr0HZDzTu | ||
96 | 16 | IYEZoDJJKPTEjlbVUjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwC | ||
97 | 17 | W/POuZ6lcg5Ktz885hZo+L7tdEy8W9ViH0Pd | ||
98 | 18 | -----END CERTIFICATE----- | ||
99 | 19 | 0 | ||
100 | === modified file 'run-tests.bat' | |||
101 | --- run-tests.bat 2012-08-15 18:08:39 +0000 | |||
102 | +++ run-tests.bat 2013-05-28 14:43:22 +0000 | |||
103 | @@ -18,7 +18,7 @@ | |||
104 | 18 | SET PYTHONEXEPATH="" | 18 | SET PYTHONEXEPATH="" |
105 | 19 | SET IGNORE_PATHS="ubuntuone\controlpanel\dbustests" | 19 | SET IGNORE_PATHS="ubuntuone\controlpanel\dbustests" |
106 | 20 | SET IGNORE_MODULES="test_linux.py, test_darwin.py" | 20 | SET IGNORE_MODULES="test_linux.py, test_darwin.py" |
108 | 21 | SET PYTHONPATH=%PYTHONPATH%;..\ubuntuone-dev-tools\;..\dirspec;. | 21 | SET PYTHONPATH=%PYTHONPATH%;..\ubuntu-sso-client;..\ubuntuone-dev-tools\;..\dirspec;. |
109 | 22 | 22 | ||
110 | 23 | ECHO Checking for Python on the path | 23 | ECHO Checking for Python on the path |
111 | 24 | :: Look for Python from buildout | 24 | :: Look for Python from buildout |
112 | 25 | 25 | ||
113 | === modified file 'setup.py' | |||
114 | --- setup.py 2012-12-03 19:45:43 +0000 | |||
115 | +++ setup.py 2013-05-28 14:43:22 +0000 | |||
116 | @@ -26,7 +26,6 @@ | |||
117 | 26 | from distutils.core import setup | 26 | from distutils.core import setup |
118 | 27 | from distutils.spawn import find_executable | 27 | from distutils.spawn import find_executable |
119 | 28 | from distutils.command import clean, build | 28 | from distutils.command import clean, build |
120 | 29 | from ubuntuone.storageprotocol.context import get_cert_location | ||
121 | 30 | 29 | ||
122 | 31 | 30 | ||
123 | 32 | class StorageProtocolBuild(build.build): | 31 | class StorageProtocolBuild(build.build): |
124 | @@ -74,11 +73,6 @@ | |||
125 | 74 | packages=['ubuntuone', | 73 | packages=['ubuntuone', |
126 | 75 | 'ubuntuone.storageprotocol'], | 74 | 'ubuntuone.storageprotocol'], |
127 | 76 | extra_path='ubuntuone-storage-protocol', | 75 | extra_path='ubuntuone-storage-protocol', |
128 | 77 | data_files=[(get_cert_location(), | ||
129 | 78 | ['data/UbuntuOne-Go_Daddy_CA.pem', | ||
130 | 79 | 'data/UbuntuOne-ValiCert_Class_2_VA.pem', | ||
131 | 80 | 'data/UbuntuOne-Go_Daddy_Class_2_CA.pem'])], | ||
132 | 81 | |||
133 | 82 | cmdclass={'build': StorageProtocolBuild, | 76 | cmdclass={'build': StorageProtocolBuild, |
134 | 83 | 'clean': StorageProtocolClean}, | 77 | 'clean': StorageProtocolClean}, |
135 | 84 | ) | 78 | ) |
136 | 85 | 79 | ||
137 | === modified file 'tests/test_context.py' | |||
138 | --- tests/test_context.py 2012-12-03 19:45:43 +0000 | |||
139 | +++ tests/test_context.py 2013-05-28 14:43:22 +0000 | |||
140 | @@ -28,7 +28,6 @@ | |||
141 | 28 | # files in the program, then also delete it here. | 28 | # files in the program, then also delete it here. |
142 | 29 | 29 | ||
143 | 30 | import os | 30 | import os |
144 | 31 | import sys | ||
145 | 32 | 31 | ||
146 | 33 | from OpenSSL import crypto, SSL | 32 | from OpenSSL import crypto, SSL |
147 | 34 | from twisted.internet import defer, error, reactor, ssl | 33 | from twisted.internet import defer, error, reactor, ssl |
148 | @@ -36,6 +35,7 @@ | |||
149 | 36 | from twisted.web import client, resource, server | 35 | from twisted.web import client, resource, server |
150 | 37 | 36 | ||
151 | 38 | from ubuntuone.storageprotocol import context | 37 | from ubuntuone.storageprotocol import context |
152 | 38 | from ubuntu_sso.utils import get_cert_dir | ||
153 | 39 | 39 | ||
154 | 40 | 40 | ||
155 | 41 | class FakeCerts(object): | 41 | class FakeCerts(object): |
156 | @@ -125,7 +125,8 @@ | |||
157 | 125 | def get_certificates(self): | 125 | def get_certificates(self): |
158 | 126 | """Get the uninstalled certificates, for testing.""" | 126 | """Get the uninstalled certificates, for testing.""" |
159 | 127 | certs = [] | 127 | certs = [] |
161 | 128 | data_dir = os.path.join(os.path.dirname(__file__), os.pardir, 'data') | 128 | data_dir = get_cert_dir() |
162 | 129 | |||
163 | 129 | for certname in ['UbuntuOne-Go_Daddy_Class_2_CA.pem', | 130 | for certname in ['UbuntuOne-Go_Daddy_Class_2_CA.pem', |
164 | 130 | 'UbuntuOne-Go_Daddy_CA.pem']: | 131 | 'UbuntuOne-Go_Daddy_CA.pem']: |
165 | 131 | cert_path = os.path.abspath(os.path.join(data_dir, certname)) | 132 | cert_path = os.path.abspath(os.path.join(data_dir, certname)) |
166 | @@ -198,46 +199,3 @@ | |||
167 | 198 | hostname="localhost") | 199 | hostname="localhost") |
168 | 199 | 200 | ||
169 | 200 | yield self.verify_context(server_context, client_context) | 201 | yield self.verify_context(server_context, client_context) |
170 | 201 | |||
171 | 202 | |||
172 | 203 | class SSLCertLocationTestCase(unittest.TestCase): | ||
173 | 204 | """Test determining the cert location.""" | ||
174 | 205 | |||
175 | 206 | @defer.inlineCallbacks | ||
176 | 207 | def setUp(self): | ||
177 | 208 | yield super(SSLCertLocationTestCase, self).setUp() | ||
178 | 209 | |||
179 | 210 | def test_win(self): | ||
180 | 211 | """Test geting a path when Common AppData is defined.""" | ||
181 | 212 | self.patch(context, "load_config_paths", | ||
182 | 213 | lambda x: [os.path.join("returned-value", x)]) | ||
183 | 214 | self.patch(sys, "platform", "win32") | ||
184 | 215 | path = context.get_cert_location() | ||
185 | 216 | self.assertEqual(path, os.path.join("returned-value", | ||
186 | 217 | "ubuntuone-storageprotocol")) | ||
187 | 218 | |||
188 | 219 | def test_darwin_frozen(self): | ||
189 | 220 | """Test that we get a path with .app in it on frozen darwin.""" | ||
190 | 221 | self.patch(sys, "platform", "darwin") | ||
191 | 222 | sys.frozen = "macosx-app" | ||
192 | 223 | self.addCleanup(delattr, sys, "frozen") | ||
193 | 224 | self.patch(context, "__file__", | ||
194 | 225 | os.path.join("path", "to", "Main.app", "ignore")) | ||
195 | 226 | path = context.get_cert_location() | ||
196 | 227 | self.assertEqual(path, os.path.join("path", "to", "Main.app", | ||
197 | 228 | "Contents", "Resources")) | ||
198 | 229 | |||
199 | 230 | def test_darwin_unfrozen(self): | ||
200 | 231 | """Test that we get a source-relative path on unfrozen darwin.""" | ||
201 | 232 | self.patch(sys, "platform", "darwin") | ||
202 | 233 | self.patch(context, "__file__", | ||
203 | 234 | os.path.join("path", "to", "ubuntuone", | ||
204 | 235 | "storageprotocol", "context.py")) | ||
205 | 236 | path = context.get_cert_location() | ||
206 | 237 | self.assertEqual(path, os.path.join("path", "to", "data")) | ||
207 | 238 | |||
208 | 239 | def test_linux(self): | ||
209 | 240 | """Test that linux gets the right path.""" | ||
210 | 241 | self.patch(sys, "platform", "linux2") | ||
211 | 242 | path = context.get_cert_location() | ||
212 | 243 | self.assertEqual(path, "/etc/ssl/certs") | ||
213 | 244 | 202 | ||
214 | === modified file 'ubuntuone/storageprotocol/context.py' | |||
215 | --- ubuntuone/storageprotocol/context.py 2012-08-16 19:21:06 +0000 | |||
216 | +++ ubuntuone/storageprotocol/context.py 2013-05-28 14:43:22 +0000 | |||
217 | @@ -30,38 +30,12 @@ | |||
218 | 30 | Standard Routines for working with ssl context creation | 30 | Standard Routines for working with ssl context creation |
219 | 31 | """ | 31 | """ |
220 | 32 | import os | 32 | import os |
221 | 33 | import sys | ||
222 | 34 | 33 | ||
223 | 35 | from OpenSSL import SSL | 34 | from OpenSSL import SSL |
224 | 36 | from twisted.internet import error, ssl | 35 | from twisted.internet import error, ssl |
225 | 37 | from twisted.python import log | 36 | from twisted.python import log |
226 | 38 | 37 | ||
253 | 39 | from dirspec.basedir import load_config_paths | 38 | from ubuntu_sso.utils import get_cert_dir |
228 | 40 | |||
229 | 41 | |||
230 | 42 | def get_cert_location(): | ||
231 | 43 | """Return path to certificate files.""" | ||
232 | 44 | |||
233 | 45 | if sys.platform == "win32": | ||
234 | 46 | ssl_cert_location = list(load_config_paths( | ||
235 | 47 | "ubuntuone-storageprotocol"))[0] | ||
236 | 48 | |||
237 | 49 | elif sys.platform == "darwin": | ||
238 | 50 | if getattr(sys, "frozen", None) is not None: | ||
239 | 51 | main_app_dir = "".join(__file__.partition(".app")[:-1]) | ||
240 | 52 | main_app_resources_dir = os.path.join(main_app_dir, | ||
241 | 53 | "Contents", | ||
242 | 54 | "Resources") | ||
243 | 55 | ssl_cert_location = main_app_resources_dir | ||
244 | 56 | else: | ||
245 | 57 | pkg_dir = os.path.dirname(__file__) | ||
246 | 58 | src_tree_path = os.path.dirname(os.path.dirname(pkg_dir)) | ||
247 | 59 | ssl_cert_location = os.path.join(src_tree_path, | ||
248 | 60 | "data") | ||
249 | 61 | else: | ||
250 | 62 | ssl_cert_location = '/etc/ssl/certs' | ||
251 | 63 | |||
252 | 64 | return ssl_cert_location | ||
254 | 65 | 39 | ||
255 | 66 | 40 | ||
256 | 67 | class HostnameVerifyContextFactory(ssl.CertificateOptions): | 41 | class HostnameVerifyContextFactory(ssl.CertificateOptions): |
257 | @@ -93,7 +67,7 @@ | |||
258 | 93 | 67 | ||
259 | 94 | def get_certificates(): | 68 | def get_certificates(): |
260 | 95 | """Get a list of certificate paths.""" | 69 | """Get a list of certificate paths.""" |
262 | 96 | ssl_cert_location = get_cert_location() | 70 | ssl_cert_location = get_cert_dir() |
263 | 97 | ca_file = ssl.Certificate.loadPEM(file(os.path.join(ssl_cert_location, | 71 | ca_file = ssl.Certificate.loadPEM(file(os.path.join(ssl_cert_location, |
264 | 98 | 'UbuntuOne-Go_Daddy_Class_2_CA.pem'), 'r').read()) | 72 | 'UbuntuOne-Go_Daddy_Class_2_CA.pem'), 'r').read()) |
265 | 99 | ca_file_2 = ssl.Certificate.loadPEM(file(os.path.join(ssl_cert_location, | 73 | ca_file_2 = ssl.Certificate.loadPEM(file(os.path.join(ssl_cert_location, |
minor lint stuff:
== Python Lint Notices ==
/Users/ mmccrack/ Documents/ Canonical/ Source/ test-improve- buildout/ scripts/ devsetup/ parts/ubuntuone -storage- protocol/ tests/test_ context. py:
31: 'sys' imported but unused
/Users/ mmccrack/ Documents/ Canonical/ Source/ test-improve- buildout/ scripts/ devsetup/ parts/ubuntuone -storage- protocol/ ubuntuone/ storageprotocol /context. py:
33: 'sys' imported but unused
39: 'load_config_paths' imported but unused