예제 #1
0
 def test_myquote(self):
     """Test myquote works."""
     # Valid char should be the same
     err_msg = "Valid chars should not be quoted"
     assert vmcp.myquote('a') == 'a', err_msg
     # Non-valid
     err_msg = "Non-Valid chars should be quoted"
     assert vmcp.myquote('%') == '%25', err_msg
예제 #2
0
 def test_myquote(self):
     """Test myquote works."""
     # Valid char should be the same
     err_msg = "Valid chars should not be quoted"
     assert vmcp.myquote("a") == "a", err_msg
     # Non-valid
     err_msg = "Non-Valid chars should be quoted"
     assert vmcp.myquote("%") == "%25", err_msg
예제 #3
0
    def _sign(self, data, salt):
        """Help function to prepare the data for signing."""
        strBuffer = ""
        # print data.keys()
        for k in sorted(data.iterkeys()):

            # Handle the BOOL special case
            v = data[k]
            if type(v) == bool:
                if v:
                    v = 1
                else:
                    v = 0
                data[k] = v

            # Update buffer
            strBuffer += "%s=%s\n" % (str(k).lower(), vmcp.myquote(str(v)))

        # Append salt
        strBuffer += salt
        return strBuffer
예제 #4
0
    def _sign(self, data, salt):
        """Help function to prepare the data for signing."""
        strBuffer = ""
        # print data.keys()
        for k in sorted(data.iterkeys()):

            # Handle the BOOL special case
            v = data[k]
            if type(v) == bool:
                if v:
                    v = 1
                else:
                    v = 0
                data[k] = v

            # Update buffer
            strBuffer += "%s=%s\n" % (str(k).lower(), vmcp.myquote(str(v)))

        # Append salt
        strBuffer += salt
        return strBuffer