Skip to content

Commit

Permalink
Merge pull request #7 from uw-it-aca/bug/mock-stable-hash
Browse files Browse the repository at this point in the history
stable hash for mock references, license date
  • Loading branch information
mikeseibel authored Feb 15, 2022
2 parents cdfc22e + 8e737fe commit fde8f71
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 25 deletions.
2 changes: 1 addition & 1 deletion panopto_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

"""
Expand Down
2 changes: 1 addition & 1 deletion panopto_client/access.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

"""
Expand Down
20 changes: 9 additions & 11 deletions panopto_client/mock_data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

"""
Expand All @@ -10,6 +10,7 @@
import sys
import os
import re
import json
from os.path import abspath, dirname


Expand Down Expand Up @@ -82,18 +83,15 @@ def _load_mock_resource_from_path(self, resource_dir, resource_path):
return mock_data

def _mock_file_path(self, portName, methodName, params):
return os.path.join(portName, methodName, md5(
self._normalize(params).encode('utf-8')).hexdigest().upper())
return os.path.join(portName, methodName, self._param_hash(params))

def _normalize(self, params):
ignored = ['auth']
normalized = {}
def _normalized(self, params):
excluded = {'auth'}
return {k: params[k] for k in params if k not in excluded}

for k in sorted(params.keys()):
if k not in ignored:
normalized[k] = params[k]

return str(normalized)
def _param_hash(self, params):
h = md5(json.dumps(self._normalized(params), sort_keys=True).encode())
return h.hexdigest().upper()

def convert_to_platform_safe(self, dir_file_name):
"""
Expand Down
2 changes: 1 addition & 1 deletion panopto_client/remote_recorder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

"""
Expand Down
2 changes: 1 addition & 1 deletion panopto_client/session.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

"""
Expand Down
2 changes: 1 addition & 1 deletion panopto_client/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

# This is just a test runner for coverage
Expand Down
2 changes: 1 addition & 1 deletion panopto_client/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


Expand Down
2 changes: 1 addition & 1 deletion panopto_client/tests/test_access.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from unittest import TestCase
Expand Down
2 changes: 1 addition & 1 deletion panopto_client/tests/test_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from unittest import TestCase
Expand Down
2 changes: 1 addition & 1 deletion panopto_client/tests/test_remote_recorder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from unittest import TestCase
Expand Down
2 changes: 1 addition & 1 deletion panopto_client/tests/test_session.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from unittest import TestCase
Expand Down
2 changes: 1 addition & 1 deletion panopto_client/tests/test_usage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from unittest import TestCase
Expand Down
2 changes: 1 addition & 1 deletion panopto_client/tests/test_user.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from unittest import TestCase
Expand Down
2 changes: 1 addition & 1 deletion panopto_client/usage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

"""
Expand Down
2 changes: 1 addition & 1 deletion panopto_client/user.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

"""
Expand Down

0 comments on commit fde8f71

Please sign in to comment.