def test_path_fail(self): with self.assertRaises(WooperAssertionError): expect.expect_json( response, "spa", path="list/[0]/baz" )
def test_pass(self): expect.expect_json( response, """{ "foo": "bar", "list": [ {"baz": "spam"}, "1", "qwe" ] }""" )
def test_fail(self): with self.assertRaises(WooperAssertionError): expect.expect_json( response, """{ "foo": "bar", "list": [ {"baz": "spa"}, "1", "qwe" ] }""" )
def step_impl_then_get_given_file_meta(context, filename): if filename == 'bike.jpg': metadata = { 'ycbcrpositioning': 1, 'imagelength': 2448, 'exifimagewidth': 2448, 'meteringmode': 2, 'datetimedigitized': '2013:08:01 16:19:28', 'exposuremode': 0, 'flashpixversion': '0100', 'isospeedratings': 80, 'length': 469900, 'imageuniqueid': 'f3533c05daef2debe6257fd99e058eec', 'datetimeoriginal': '2013:08:01 16:19:28', 'whitebalance': 0, 'exposureprogram': 3, 'colorspace': 1, 'exifimageheight': 3264, 'software': 'Google', 'resolutionunit': 2, 'make': 'SAMSUNG', 'maxaperturevalue': [276, 100], 'aperturevalue': [276, 100], 'scenecapturetype': 0, 'exposuretime': [1, 2004], 'datetime': '2013:08:01 16:19:28', 'exifoffset': 216, 'yresolution': [72, 1], 'orientation': 1, 'componentsconfiguration': '0000', 'exifversion': '0220', 'focallength': [37, 10], 'flash': 0, 'model': 'GT-I9300', 'xresolution': [72, 1], 'fnumber': [26, 10], 'imagewidth': 3264 } elif filename == 'green.ogg': metadata = { 'producer': 'Xiph.Org libVorbis I 20050304', 'music_genre': 'New Age', 'sample_rate': '48000', 'artist': 'Maxime Abbey', 'length': 12996555, 'bit_rate': '224000', 'title': 'Green Hills', 'mime_type': 'audio/vorbis', 'format_version': 'Vorbis version 0', 'comment': '"Green Hills"\\nVersion 2.0 (2007-05-31)\\nCopyright (C) ' '2002-2007 Maxime Abbey\\nPlaying Time: ' '08:14\\n--------------------------\\nWebsite: ' 'http://www.arachnosoft.com\\nE-Mail: ' '[email protected]\\n--------------------------\\nFreely ' 'distributed under copyright for personal and non-commercial ' 'use. Visit http(...)', 'compression': 'Vorbis', 'creation_date': '2007-01-01T00:00:00+00:00', 'duration': '0:08:14.728000', 'endian': 'Little endian', 'music_composer': 'Maxime Abbey', 'nb_channel': '2' } elif filename == 'this_week_nasa.mp4': metadata = { 'mime_type': 'video/mp4', 'creation_date': '2014-06-13T19:26:17+00:00', 'duration': '0:03:19.733066', 'width': '480', 'length': 24757257, 'comment': 'User volume: 100.0%', 'height': '270', 'endian': 'Big endian', 'last_modification': '2014-06-13T19:26:18+00:00' } else: raise NotImplementedError("No metadata for file '{}'.".format(filename)) expect_json( context.response, metadata, path='filemeta' )
def step_impl_then_get_given_file_meta(context, filename): if filename == 'bike.jpg': metadata = { 'ycbcrpositioning': 1, 'imagelength': 2448, 'exifimagewidth': 2448, 'meteringmode': 2, 'datetimedigitized': '2013:08:01 16:19:28', 'exposuremode': 0, 'flashpixversion': '0100', 'isospeedratings': 80, 'length': 469900, 'imageuniqueid': 'f3533c05daef2debe6257fd99e058eec', 'datetimeoriginal': '2013:08:01 16:19:28', 'whitebalance': 0, 'exposureprogram': 3, 'colorspace': 1, 'exifimageheight': 3264, 'software': 'Google', 'resolutionunit': 2, 'make': 'SAMSUNG', 'maxaperturevalue': [276, 100], 'aperturevalue': [276, 100], 'scenecapturetype': 0, 'exposuretime': [1, 2004], 'datetime': '2013:08:01 16:19:28', 'exifoffset': 216, 'yresolution': [72, 1], 'orientation': 1, 'componentsconfiguration': '0000', 'exifversion': '0220', 'focallength': [37, 10], 'flash': 0, 'model': 'GT-I9300', 'xresolution': [72, 1], 'fnumber': [26, 10], 'imagewidth': 3264 } elif filename == 'green.ogg': metadata = { 'producer': 'Xiph.Org libVorbis I 20050304', 'music_genre': 'New Age', 'sample_rate': '48000', 'artist': 'Maxime Abbey', 'length': 12996555, 'bit_rate': '224000', 'title': 'Green Hills', 'mime_type': 'audio/vorbis', 'format_version': 'Vorbis version 0', 'comment': '"Green Hills"\\nVersion 2.0 (2007-05-31)\\nCopyright (C) ' '2002-2007 Maxime Abbey\\nPlaying Time: ' '08:14\\n--------------------------\\nWebsite: ' 'http://www.arachnosoft.com\\nE-Mail: ' '[email protected]\\n--------------------------\\nFreely ' 'distributed under copyright for personal and non-commercial ' 'use. Visit http(...)', 'compression': 'Vorbis', 'creation_date': '2007-01-01T00:00:00+00:00', 'duration': '0:08:14.728000', 'endian': 'Little endian', 'music_composer': 'Maxime Abbey', 'nb_channel': '2' } elif filename == 'this_week_nasa.mp4': metadata = { 'mime_type': 'video/mp4', 'creation_date': '2014-06-13T19:26:17+00:00', 'duration': '0:03:19.733066', 'width': '480', 'length': 24757257, 'comment': 'User volume: 100.0%', 'height': '270', 'endian': 'Big endian', 'last_modification': '2014-06-13T19:26:18+00:00' } else: raise NotImplementedError( "No metadata for file '{}'.".format(filename)) expect_json(context.response, metadata, path='filemeta')
def step_impl_then_get_given_file_meta(context, filename): if filename == 'bike.jpg': metadata = { 'ycbcrpositioning': 1, 'imagelength': 2448, 'exifimagewidth': 2448, 'meteringmode': 2, 'datetimedigitized': '2013:08:01 16:19:28', 'exposuremode': 0, 'flashpixversion': '0100', 'isospeedratings': 80, 'length': 469900, 'imageuniqueid': 'f3533c05daef2debe6257fd99e058eec', 'datetimeoriginal': '2013:08:01 16:19:28', 'whitebalance': 0, 'exposureprogram': 3, 'colorspace': 1, 'exifimageheight': 3264, 'software': 'Google', 'resolutionunit': 2, 'make': 'SAMSUNG', 'maxaperturevalue': [276, 100], 'aperturevalue': [276, 100], 'scenecapturetype': 0, 'exposuretime': [1, 2004], 'datetime': '2013:08:01 16:19:28', 'exifoffset': 216, 'yresolution': [72, 1], 'orientation': 1, 'componentsconfiguration': '0000', 'exifversion': '0220', 'focallength': [37, 10], 'flash': 0, 'model': 'GT-I9300', 'xresolution': [72, 1], 'fnumber': [26, 10], 'imagewidth': 3264 } elif filename == 'green.ogg': metadata = { 'producer': 'Lavf54.59.103', 'music_genre': 'New Age', 'sample_rate': '44100', 'artist': 'Maxime Abbey', 'length': 368058, 'bit_rate': '160000', 'title': 'Green Hills', 'mime_type': 'audio/vorbis', 'format_version': 'Vorbis version 0', 'compression': 'Vorbis', 'duration': '0:00:20.088163', 'endian': 'Little endian', 'nb_channel': '2' } elif filename == 'this_week_nasa.mp4': metadata = { 'mime_type': 'video/mp4', 'creation_date': '1904-01-01T00:00:00+00:00', 'duration': '0:00:10.224000', 'width': '480', 'length': 877869, 'comment': 'User volume: 100.0%', 'height': '270', 'endian': 'Big endian', 'last_modification': '1904-01-01T00:00:00+00:00' } else: raise NotImplementedError("No metadata for file '{}'.".format(filename)) expect_json( context.response, metadata, path='filemeta' )
def test_path_pass(self): expect.expect_json( response, "spam", path="list/[0]/baz" )
def step_impl_then_get_given_file_meta(context, filename): if filename == 'bike.jpg': metadata = { 'ycbcrpositioning': 1, 'imagelength': 2448, 'exifimagewidth': 2448, 'meteringmode': 2, 'datetimedigitized': '2013:08:01 16:19:28', 'exposuremode': 0, 'flashpixversion': '0100', 'isospeedratings': 80, 'length': 469900, 'imageuniqueid': 'f3533c05daef2debe6257fd99e058eec', 'datetimeoriginal': '2013:08:01 16:19:28', 'whitebalance': 0, 'exposureprogram': 3, 'colorspace': 1, 'exifimageheight': 3264, 'software': 'Google', 'resolutionunit': 2, 'make': 'SAMSUNG', 'maxaperturevalue': [276, 100], 'aperturevalue': [276, 100], 'scenecapturetype': 0, 'exposuretime': [1, 2004], 'datetime': '2013:08:01 16:19:28', 'exifoffset': 216, 'yresolution': [72, 1], 'orientation': 1, 'componentsconfiguration': '0000', 'exifversion': '0220', 'focallength': [37, 10], 'flash': 0, 'model': 'GT-I9300', 'xresolution': [72, 1], 'fnumber': [26, 10], 'imagewidth': 3264 } elif filename == 'green.ogg': metadata = { 'producer': 'Lavf54.59.103', 'music_genre': 'New Age', 'sample_rate': '44100', 'artist': 'Maxime Abbey', 'length': 368058, 'bit_rate': '160000', 'title': 'Green Hills', 'mime_type': 'audio/vorbis', 'format_version': 'Vorbis version 0', 'compression': 'Vorbis', 'duration': '0:00:20.088163', 'endian': 'Little endian', 'nb_channel': '2' } elif filename == 'this_week_nasa.mp4': metadata = { 'mime_type': 'video/mp4', 'creation_date': '1904-01-01T00:00:00+00:00', 'duration': '0:00:10.224000', 'width': '480', 'length': 877869, 'comment': 'User volume: 100.0%', 'height': '270', 'endian': 'Big endian', 'last_modification': '1904-01-01T00:00:00+00:00' } else: raise NotImplementedError( "No metadata for file '{}'.".format(filename)) expect_json(context.response, metadata, path='filemeta')