Exemple #1
0
 def test_parse_props(self):
     fields = [
         'id', 'name', 'description', 'cTag', 'eTag', 'size', 'webUrl'
     ]
     for f in fields:
         self.assertEqual(self.data[f],
                          getattr(self.item, to_underscore_name(f)), f)
     self.assertFalse(self.item.is_folder)
     self.assertEqual(items.OneDriveItemTypes.IMAGE, self.item.type)
Exemple #2
0
def assert_properties(test, data, obj):
    """
    Assuming data uses camelCase and obj properties uses underscored lowercase, test if the property in obj matches the
    value in data.
    :param unittest.TestCase test:
    :param dict[str, T] data:
    :param T obj:
    """
    for k, v in data.items():
        if 'DateTime' in k:
            k = k.replace('DateTime', 'Time')
            v = str_to_datetime(v)
        if 'lastModified' in k:
            k = k.replace('lastModified', 'modified')
        test.assertEqual(v, getattr(obj, to_underscore_name(k)), 'The property %s does not match data.' % k)
Exemple #3
0
def assert_properties(test, data, obj):
    """
    Assuming data uses camelCase and obj properties uses underscored lowercase, test if the property in obj matches the
    value in data.
    :param unittest.TestCase test:
    :param dict[str, T] data:
    :param T obj:
    """
    for k, v in data.items():
        if 'DateTime' in k:
            k = k.replace('DateTime', 'Time')
            v = str_to_datetime(v)
        if 'lastModified' in k:
            k = k.replace('lastModified', 'modified')
        test.assertEqual(v, getattr(obj, to_underscore_name(k)),
                         'The property %s does not match data.' % k)
Exemple #4
0
 def test_parse_props(self):
     fields = ['id', 'name', 'description', 'cTag', 'eTag', 'size', 'webUrl']
     for f in fields:
         self.assertEqual(self.data[f], getattr(self.item, to_underscore_name(f)), f)
     self.assertFalse(self.item.is_folder)
     self.assertEqual(items.OneDriveItemTypes.IMAGE, self.item.type)