Skip to content

Commit f15b976

Browse files
committed
Merge pull request #1 from PolBaladas/addTestPatch
Add aggregations_test and validate raw data obtained in get_map
2 parents b2ab473 + b45e36c commit f15b976

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,22 @@ def test_user(self):
9595
def test_get_map(self):
9696
self.map_file = os.path.join(os.getcwd(), 'markdown.png')
9797
data = self.loklak.get_map(17.582729, 79.118320)
98+
self.assertTrue(data[:8] == '\211PNG\r\n\032\n'and (data[12:16] == 'IHDR'))
9899
with open(self.map_file, 'wb') as f:
99100
f.write(data)
100101
with open(self.map_file, 'rb') as f:
101102
file_contents = f.read()
102103
self.assertTrue(os.path.exists(self.map_file))
103104
self.assertEqual(data, file_contents)
104105

106+
def test_aggregations(self):
107+
"""test aggregations"""
108+
result = self.loklak.aggregations('sudheesh001','2015-01-10','2015-10-21',['mentions','hashtags'],10)
109+
data = result.json()
110+
self.assertEqual(result.status_code,200)
111+
self.assertTrue('aggregations' in data)
112+
self.assertTrue('hashtags' in data['aggregations'])
113+
self.assertTrue('mentions' in data['aggregations'])
114+
105115
if __name__ == '__main__':
106116
unittest.main()

0 commit comments

Comments
 (0)