File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,6 @@ Valerio Cosentino <valcos@bitergia.com>
77Jose Javier Merchante <jjmerchante@bitergia.com>
88Chris Burgess <chris.burgess@catalyst.net.nz>
99devpod.cn <support@devpod.cn>
10- Venu Vardhan Reddy Tekula <venu@chaoss.community >
10+ Venu Vardhan Reddy Tekula <vt2182@nyu.edu >
1111Matt Gaughan <mgaughan@proton.me>
1212
Original file line number Diff line number Diff line change @@ -688,9 +688,9 @@ def parse(self, *args):
688688 """
689689 parsed_args = self .parser .parse_args (args )
690690
691- # Category was not set, remove it
691+ # Ensure category is set
692692 if parsed_args .category is None :
693- delattr ( parsed_args , ' category' )
693+ parsed_args . category = self . _backend . CATEGORIES [ 0 ]
694694
695695 if self ._from_date :
696696 parsed_args .from_date = str_to_datetime (parsed_args .from_date )
Original file line number Diff line number Diff line change 1+ ---
2+ title : Refactor Backend Fetch Logic
3+ category : other
4+ author : Venu Vardhan Reddy Tekula <vt2182@nyu.edu>
5+ issue : 527
6+ notes : >
7+ Refactored the `Backend` class to simplify and improve maintainability.
8+ The `fetch` method is no longer overridden in subclasses. Instead,
9+ subclasses are only required to implement the `fetch_items` method, where
10+ the specific data retrieval logic is defined. This change ensures that any
11+ updates to the `fetch` method in the `Backend` class are automatically
12+ inherited by all subclasses, reducing the need to propagate changes across
13+ multiple classes.
Original file line number Diff line number Diff line change @@ -1093,26 +1093,19 @@ def test_incompatible_fetch_archive_and_no_archive(self):
10931093 with self .assertRaises (AttributeError ):
10941094 _ = parser .parse (* args )
10951095
1096- def test_fetch_archive_needs_category (self ):
1097- """Test if fetch-archive needs a category"""
1098-
1099- args = ['--fetch-archive' ]
1100- parser = BackendCommandArgumentParser (MockedBackendCommand .BACKEND ,
1101- archive = True )
1102-
1103- with self .assertRaises (AttributeError ):
1104- _ = parser .parse (* args )
1105-
1106- def test_remove_empty_category (self ):
1107- """Test whether category argument is removed when no value is given"""
1096+ def test_default_category (self ):
1097+ """Test whether a default category is set if none is provided"""
11081098
1099+ # No category is provided
11091100 args = []
11101101 parser = BackendCommandArgumentParser (MockedBackendCommand .BACKEND ,
11111102 archive = True )
11121103 parsed_args = parser .parse (* args )
11131104
1114- with self .assertRaises (AttributeError ):
1115- _ = parsed_args .category
1105+ self .assertEqual (parsed_args .category , MockedBackendCommand .BACKEND .DEFAULT_CATEGORY )
1106+
1107+ def test_specific_category (self ):
1108+ """Test whether a specific category is set when provided"""
11161109
11171110 # An empty string is parsed
11181111 args = ['--category' , '' ]
You can’t perform that action at this time.
0 commit comments