1
+ """
2
+ Testing fwix_geo API
3
+ """
4
+
5
+ from fwix_geo_api import *
6
+
7
+ kFWIX_API_KEY = '42a97fb59252'
8
+ kFWIX_LAT = 37.787462
9
+ kFWIX_LON = - 122.399223
10
+ kRANDOM_PLACE_UUID = '17f5fcd-3312-7a52-f551-d4e8f70dbc8a9'
11
+ kRANDOM_POSTCODE = 94117
12
+
13
+ fwix = FwixApi (kFWIX_API_KEY )
14
+
15
+ class GeoApiTest ():
16
+ """testing fwix geo"""
17
+
18
+ def get_categories ():
19
+ """ Tests get_categories"""
20
+ return fwix .get_categories ()
21
+
22
+ def get_location (lat , lng ):
23
+ """ Tests get_location"""
24
+ return fwix .get_location (lat , lng )
25
+
26
+ def get_place (uuid ):
27
+ """ Tests get_place"""
28
+ return fwix .get_place (uuid )
29
+
30
+ def get_places_by_lat_lng (lat , lng ):
31
+ """ Tests get_places_by_lat_lng"""
32
+ return fwix .get_places_by_lat_lng (lat , lng )
33
+
34
+ def get_places_by_zip (zip ):
35
+ """ Tests get_places_by_postal_code"""
36
+ return fwix .get_places_by_postal_code (zip )
37
+
38
+ def get_places_by_loc (lat , lng ):
39
+ """ Tests get_places_by_loc given latitude and longitude"""
40
+ loc = fwix .get_location (lat , lng )
41
+ return fwix .get_places_by_location (loc )
42
+
43
+ def get_content_by_lat_lng (lat , lng ):
44
+ """ Tests get_content_by_lat_lng for all content types"""
45
+ return fwix .get_content_by_lat_lng (lat ,lng , kCONTENT_TYPE_ALL )
46
+
47
+ def get_specific_content_by_lat_lng (content_type , lat , lng ):
48
+ """ Tests get_content_by_lat_lng for a specific content type"""
49
+ return fwix .get_content_by_lat_lng (lat ,lng ,content_type )
50
+
51
+ def get_content_by_zip (zip ):
52
+ """ Tests get_content_by_postal_code for all content types"""
53
+ return fwix .get_content_by_postal_code (zip , kCONTENT_TYPE_ALL )
54
+
55
+ def get_specific_content_by_zip (zip , content_type ):
56
+ """ Tests get_content_by_postal_code for a specific content type"""
57
+ return fwix .get_content_by_postal_code (zip ,content_type )
58
+
59
+ def get_content_by_location (lat , lng , content_type ):
60
+ """ Tests get_content_by_location for a specific content type"""
61
+ return fwix .get_content_by_location (fwix .get_location (lat , lng ), content_type )
62
+
63
+ def get_content_by_place (uuid , content_type ):
64
+ """ Tests get_content_by_place for a specific content type"""
65
+ return fwix .get_content_by_place (uuid , content_type )
66
+
67
+ if __name__ == '__main__' :
68
+ print get_location (kFWIX_LAT , kFWIX_LON )
69
+
70
+ print get_categories ()
71
+
72
+ print get_place (kRANDOM_PLACE_UUID )
73
+
74
+ print get_places_by_lat_lng (kFWIX_LAT , kFWIX_LON )
75
+
76
+ print get_places_by_zip (kRANDOM_POSTCODE )
77
+
78
+ print get_places_by_loc (kFWIX_LAT , kFWIX_LON )
79
+
80
+ print get_content_by_lat_lng (kFWIX_LAT , kFWIX_LON )
81
+
82
+ print get_specific_content_by_lat_lng (kCONTENT_TYPE_STATUS_UPDATES , kFWIX_LAT , kFWIX_LON )
83
+
84
+ print get_content_by_zip (kRANDOM_POSTCODE )
85
+
86
+ print get_specific_content_by_zip (kRANDOM_POSTCODE , kCONTENT_TYPE_STATUS_UPDATES )
87
+
88
+ print get_content_by_location (kFWIX_LAT , kFWIX_LON , kCONTENT_TYPE_STATUS_UPDATES )
89
+
90
+ print get_content_by_place (kRANDOM_PLACE_UUID , kCONTENT_TYPE_NEWS )
0 commit comments