Skip to content

Commit

Permalink
Merge pull request #31 from pyqa/compare_utility
Browse files Browse the repository at this point in the history
Rest Api Tests with complete function coverage
  • Loading branch information
surevs authored Feb 4, 2019
2 parents 9e7b503 + 14614bd commit d36846e
Show file tree
Hide file tree
Showing 17 changed files with 172 additions and 275 deletions.
30 changes: 0 additions & 30 deletions Examples/FilesCompare/files_comparison_example.py

This file was deleted.

10 changes: 0 additions & 10 deletions Examples/FilesCompare/first.json

This file was deleted.

Binary file removed Examples/FilesCompare/first.xlsx
Binary file not shown.
13 changes: 0 additions & 13 deletions Examples/FilesCompare/fourth.json

This file was deleted.

42 changes: 42 additions & 0 deletions Examples/FilesCompare/samplecomparisontest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""Example for Comparison module."""
from imgqa import Compare

# Variable Stack / Data
image1 = "highway.jpg"
image2 = "highway_altered.jpg"
source_xl = "source.xlsx"
target_xl = "target.xlsx"
source_csv = "source_csv.csv"
target_csv = "target_csv.csv"
source_json = "{'as': 1," \
"'a': {'b': {'cs':10, 'qqq': {'qwe':1}}," \
"'d': {'csd':30}}}"
target_json = "{'as': 1," \
"'a': {'b': {'ds':10, 'qqq': {'qwe':11}}," \
"'d': {'dsd':40}}}"


class TestCompareFiles(Compare):
"""Sample Test Suite."""

def test_compare_images(self):
"""Compare images."""
self.assertEqual(self.compare_images(image1, image1), 1.0)

def test_compare_jsons(self):
"""Compare jsons."""
self.assertNotEqual(self.compare_json(source_json, target_json), '{}')

def test_compare_workbooks(self):
"""Compare spreadsheet.
xl file will be generated with file difference.
"""
self.compare_files(source_xl, target_xl)

def test_compare_files(self):
"""Compare spreadsheet.
xl file will be generated with file difference.
"""
self.compare_files(source_csv, target_csv)
Binary file removed Examples/FilesCompare/sea.jpg
Binary file not shown.
15 changes: 0 additions & 15 deletions Examples/FilesCompare/second.json

This file was deleted.

Binary file removed Examples/FilesCompare/second.xlsx
Binary file not shown.
Binary file added Examples/FilesCompare/source.xlsx
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Year,Industry_aggregation_NZSIOC,Industry_code_NZSIOC,Industry_name_NZSIOC,Units,Variable_code,Variable_name,Variable_category,Value,Industry_code_ANZSIC06
2017,Level 4,AA111,Horticulture and Fruit Growing,Dollars (millions),H04,"Sales, government funding, grants and subsidies",Financial performance,3999,"ANZSIC06 groups A011, A012, and A013"
2017,Level 4,AA111,Horticulture and Fruit Growing,Dollars (millions),H04,"Sales, government funding, grants and subsidies",Financial performance,3999,"ANZSIC06 groups A011, A012, and A013"

2017,Level 4,AA111,Horticulture and Fruit Growing,Dollars (millions),H04,"Sales, government funding, grants and subsidies",Financial performance,3999,"ANZSIC06 groups A011, A012, and A013"
Binary file added Examples/FilesCompare/target.xlsx
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Year,Industry_aggregation_NZSIOC,Industry_code_NZSIOC,Industry_name_NZSIOC,Units,Variable_code,Variable_name,Variable_category,Value,Industry_code_ANZSIC06
2017,Level 4,AA111,Horticulture and Fruit Growing,Dollars (millions),H04,"Sales, government funding, grants and subsidies",Financial performance,3999,"ANZSIC06 groups A011, A012, and A013"
2016,Level 3,AA111,Horticulture and Fruit Growing,Dollars (millions),H03,"Sales, government funding, grants and subsidies",Financial performance,3998,"ANZSIC06 groups A011, A012, and A014"

Year,Industry_aggregation_NZSIOC,Industry_code_NZSIOC,Industry_name_NZSIOC,Units,Variable_code,Variable_name,Variable_category,Value,Industry_code_ANZSIC06
2017,Level 4,AA111,Horticulture and Fruit Growing,Dollars (millions),H04,"Sales, government funding, grants and subsidies",Financial performance,3999,"ANZSIC06 groups A011, A012, and A013"
2016,Level 3,AA111,Horticulture and Fruit Growing,Dollars (millions),H03,"Sales, government funding, grants and subsidies",Financial performance,3998,"ANZSIC06 groups A011, A012, and A014"
13 changes: 0 additions & 13 deletions Examples/FilesCompare/third.json

This file was deleted.

10 changes: 8 additions & 2 deletions Examples/samplerestapitest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ def test_get_users(self):
"""Get users from application."""
users = self.apirequest(method="GET", url=uri)
resp = json.loads(users.text)
logging.warning(resp)
self.assert_not_in_resp(resp=resp, member='Georg1e',
logging.info(resp)
self.assert_in_resp(resp=resp, member='orge',
container='resp.data.0.first_name')
self.assert_equal_resp(resp=resp, member='George',
container='resp.data.0.first_name')
self.assert_not_equal_resp(resp=resp, member='George1',
container='resp.data.0.first_name')
self.assert_not_in_resp(resp=resp, member='John',
container='resp.data.0.first_name')

def test_post_users(self):
Expand Down
Loading

0 comments on commit d36846e

Please sign in to comment.