# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # Written by Troy Farrell <*****@*****.**> # Created: 20090806 import StringIO import unittest # The next few lines make the import work if the test is run from the tests # directory. import testutils handsetdetection = testutils.importModule("handsetdetection") import handsetdetection.exceptions as exceptions from handsetdetection.hdapiv2 import HandsetDetectionDeviceInformation class HandsetDetectionAuthenticationTests(unittest.TestCase): "Tests for handsetdetection authentication" def test_usertoken(self): "Test HandsetDetection.set_credentials()." # Constructor hd = handsetdetection.HandsetDetection("foo", "bar") self.assertNotEqual(hd._usertoken, None) # Convenience functions self.assertRaises(ValueError, handsetdetection.vendor)
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # Author: Troy Farrell <*****@*****.**> # Created: 20090806 import unittest #import handsetdetection.wsseut as wsseut # The next few lines make the import work if the test is run from the tests # directory. import testutils handsetdetection = testutils.importModule("handsetdetection.wsseut") wsseut = handsetdetection.wsseut del handsetdetection class HandsetDetectionWSSEUsernameTokenTests(unittest.TestCase): "Tests for WSSE support" def testWSSEUTHeaders(self): "Test password digest generation." authHeader='WSSE profile="UsernameToken"' wsseHeader=('UsernameToken Username="******", ' 'PasswordDigest="quR/EWLAV4xLf9Zqyw4pDmfV9OY=", ' 'Nonce="ZDM2ZTMxNjI4Mjk1OWE5ZWQ0Yzg5ODUxNDk3YTcxN2Y=", ' 'Created="2003-12-15T14:43:07Z"') ut = wsseut.WSSEUserTokenHeaderGenerator( "bob",
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # import datetime import unittest import testutils import os.path import re import time handsetdetection = testutils.importModule("handsetdetection") import handsetdetection.exceptions as exceptions from handsetdetection.HD4 import * #unittest.TestLoader.sortTestMethodsUsing = None class TestLoader: sortTestMethodsUsing = None class HD4Tests(unittest.TestCase): cloudConfig = 'hd4CloudConfig.yml' ultimateConfig = 'hd4UltimateConfig.yml' communityConfig = 'hd4CommunityConfig.yml' devices = { 'NokiaN95': {
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # Author: Troy Farrell <*****@*****.**> # Created: 20090806 import unittest #import handsetdetection.wsseut as wsseut # The next few lines make the import work if the test is run from the tests # directory. import testutils handsetdetection = testutils.importModule("handsetdetection.wsseut") wsseut = handsetdetection.wsseut del handsetdetection class HandsetDetectionWSSEUsernameTokenTests(unittest.TestCase): "Tests for WSSE support" def testWSSEUTHeaders(self): "Test password digest generation." authHeader = 'WSSE profile="UsernameToken"' wsseHeader = ('UsernameToken Username="******", ' 'PasswordDigest="quR/EWLAV4xLf9Zqyw4pDmfV9OY=", ' 'Nonce="ZDM2ZTMxNjI4Mjk1OWE5ZWQ0Yzg5ODUxNDk3YTcxN2Y=", ' 'Created="2003-12-15T14:43:07Z"') ut = wsseut.WSSEUserTokenHeaderGenerator(