예제 #1
0
    def test_0a_1_1_8_validate_key(self):
        user = User(username="******", password="******")

        class tst(object):
            def __init__(self):
                self.Id = 41
                self.paSSword = "******"
                self.username = "******"
                self.bool1 = True
                self.bool2 = False
                self.nr = NotReceived()
                self.unsupported1 = {}
                self.unsupported2 = user

        validation_obj = tst()
        validated = []
        for key in [
                "Id", "paSSword", "username", "bool1", "bool2", "nr",
                "unsupported1", "unsupported2"
        ]:
            validated.append(
                validate_key(validation_obj, key, unsupported=False))
        self.assertEqual([False, False, True, True, True, False, False, False],
                         validated)
        print("Test 0a_1_1_8 : validate_key: with object")
예제 #2
0
    def test_0a_1_1_8_validate_key(self):
        product = Product(name="Cheese",
                          price=50.4,
                          quantity=7.89,
                          code=789456611)

        class tst(object):
            def __init__(self):
                self.Id = 41
                self.paSSword = "******"
                self.username = "******"
                self.bool1 = True
                self.bool2 = False
                self.nr = NotReceived()
                self.unsupported1 = {}
                self.unsupported2 = product

        validation_obj = tst()
        validated = []
        for key in [
                "Id", "paSSword", "username", "bool1", "bool2", "nr",
                "unsupported1", "unsupported2"
        ]:
            validated.append(
                validate_key(validation_obj, key, unsupported=False))
        self.assertEqual([False, False, True, True, True, False, False, False],
                         validated)
        print("Test 0a_1_1_8 : validate_key: with object")
예제 #3
0
 def test_0a_1_1_4_validate_key(self):
     the_dict = {
         "id": 41,
         "password": "******",
         "username": "******",
         "bool1": True,
         "bool2": False,
         "nr": NotReceived()
     }
     validated = []
     for key in the_dict:
         validated.append(validate_key(the_dict, key, dangerous=True))
     self.assertEqual([False, True, True, True, True, False], validated)
     print("Test 0a_1_1_4 : validate_key: success")
예제 #4
0
 def test_0a_1_1_7_validate_key(self):
     user = User(username="******", password="******")
     the_dict = {
         "Id": 41,
         "paSSword": "******",
         "username": "******",
         "bool1": True,
         "bool2": False,
         "nr": NotReceived(),
         "unsupported1": {},
         "unsupported2": user
     }
     validated = []
     for key in the_dict:
         validated.append(validate_key(the_dict, key, unsupported=False))
     self.assertEqual([False, False, True, True, True, False, False, False],
                      validated)
     print("Test 0a_1_1_7 : validate_key: success")
예제 #5
0
 def test_0a_1_1_7_validate_key(self):
     product = Product(name="Cheese",
                       price=50.4,
                       quantity=7.89,
                       code=789456611)
     the_dict = {
         "Id": 41,
         "paSSword": "******",
         "username": "******",
         "bool1": True,
         "bool2": False,
         "nr": NotReceived(),
         "unsupported1": {},
         "unsupported2": product
     }
     validated = []
     for key in the_dict:
         validated.append(validate_key(the_dict, key, unsupported=False))
     self.assertEqual([False, False, True, True, True, False, False, False],
                      validated)
     print("Test 0a_1_1_7 : validate_key: success")