예제 #1
0
    def test_0a_1_2_3_get_dict(self):
        user = User(username="******", password="******")
        the_dict = {
            "Id": 41,
            "paSSword": "******",
            "username": "******",
            "bool1": True,
            "bool2": False,
            "nr": NotReceived(),
            "unsupported1": {},
            "unsupported2": user
        }
        validated = get_dict(the_dict, id=True, dangerous=True)
        self.assertEqual(
            validated, {
                "username": "******",
                "bool1": True,
                "bool2": False,
                "paSSword": "******",
                "Id": 41
            })

        validated = get_dict(the_dict)
        self.assertEqual(validated, {
            "username": "******",
            "bool1": True,
            "bool2": False
        })
        print("Test 0a_1_2_3 : get_dict: with dict")
예제 #2
0
    def test_0a_1_2_3_get_dict(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 = get_dict(the_dict, id=True, dangerous=True)
        self.assertEqual(
            validated, {
                "username": "******",
                "bool1": True,
                "bool2": False,
                "paSSword": "******",
                "Id": 41
            })

        validated = get_dict(the_dict)
        self.assertEqual(validated, {
            "username": "******",
            "bool1": True,
            "bool2": False
        })
        print("Test 0a_1_2_3 : get_dict: with dict")
예제 #3
0
 def __init__(self):
     self.Id = 41
     self.paSSword = "******"
     self.username = "******"
     self.bool1 = True
     self.bool2 = False
     self.nr = NotReceived()
     self.unsupported1 = {}
     self.unsupported2 = user
예제 #4
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")
예제 #5
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")
예제 #6
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")