コード例 #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
ファイル: test_vmcp.py プロジェクト: chandra1b/pybossa
 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
ファイル: test_vmcp.py プロジェクト: CulturePlex/pybossa
    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