Skip to content

Commit

Permalink
Pepper the codebase with 'nosec' in an attempt to fix codefactor
Browse files Browse the repository at this point in the history
  • Loading branch information
audiodude committed Aug 17, 2024
1 parent 7816048 commit 77b9e1a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions wp1/scores_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,22 @@ def test_get_pageview_url_prev(self, mock_datetime):
@patch('wp1.scores.get_current_datetime', return_value=datetime(2024, 5, 25))
def test_get_prev_file_path(self, mock_datetime):
actual = scores.get_prev_file_path()
self.assertEqual('/tmp/pageviews/pageviews-202403-user.bz2', actual)
self.assertEqual(

Check warning on line 97 in wp1/scores_test.py

View check run for this annotation

codefactor.io / CodeFactor

wp1/scores_test.py#L97

Probable insecure usage of temp file/directory. (B108)
'/tmp/pageviews/pageviews-202403-user.bz2', # nosec
actual)

@patch('wp1.scores.get_current_datetime', return_value=datetime(2024, 5, 25))
def test_get_cur_file_path(self, mock_datetime):
def test_get_cur_file_path(self, mock_datetime): # nosec

Check warning on line 102 in wp1/scores_test.py

View check run for this annotation

codefactor.io / CodeFactor

wp1/scores_test.py#L102

Probable insecure usage of temp file/directory. (B108)
actual = scores.get_cur_file_path()
self.assertEqual('/tmp/pageviews/pageviews-202404-user.bz2', actual)
self.assertEqual(
'/tmp/pageviews/pageviews-202404-user.bz2', # nosec
actual)

Check warning on line 106 in wp1/scores_test.py

View check run for this annotation

codefactor.io / CodeFactor

wp1/scores_test.py#L106

Probable insecure usage of temp file/directory. (B108)

def test_get_pageview_file_path(self):
def test_get_pageview_file_path(self): # nosec
actual = scores.get_pageview_file_path('pageviews-202404-user.bz2')
self.assertEqual('/tmp/pageviews/pageviews-202404-user.bz2', actual)
self.assertEqual(
'/tmp/pageviews/pageviews-202404-user.bz2', # nosec
actual)

@patch('wp1.scores.get_current_datetime', return_value=datetime(2024, 5, 25))
@patch("builtins.open", new_callable=mock_open, read_data=pageview_bz2)
Expand Down

0 comments on commit 77b9e1a

Please sign in to comment.