#12 Allow the ':' separator for NSVCs.
Merged 7 years ago by ralph. Opened 7 years ago by ralph.
ralph/module_diff master  into  master

file modified
+5 -4
@@ -9,10 +9,11 @@ 

          self.params = {'verbose': 'true'}

  

      def get_module(self, nsvc):

-         name = nsvc.split("-")[0:-3]

-         stream = nsvc.split("-")[-3]

-         version = nsvc.split("-")[-2]

-         context = nsvc.split("-")[-1]

+         sep = ':' if ':' in nsvc else '-'

+         name = nsvc.split(sep)[0:-3]

+         stream = nsvc.split(sep)[-3]

+         version = nsvc.split(sep)[-2]

+         context = nsvc.split(sep)[-1]

          params = dict(self.params)

          params.update({'name': name, 'stream': stream, 'version': version, 'context': context})

          res = requests.get(self.mbs_url, params=params)

file modified
+23
@@ -88,6 +88,29 @@ 

              assert "RPMs which dist tag changed" not in output

              assert "RPMs Reused" not in output

  

+     def test_cli_colon_delimited(self, mbs_json_res, capsys):

+         """ Test that we can handle colon delimited NSVC. """

+ 

+         module1_res, module2_res = generate_module_res(mbs_json_res)

+ 

+         with requests_mock.mock() as mock_http:

+             mock_http.register_uri("GET", module1_url, json=module1_res)

+             mock_http.register_uri("GET", module2_url, json=module2_res)

+ 

+             cli_cmd = [

+                 'module_diff',

+                 'mariadb:10.2:20171019133930:00000000',

+                 'mariadb:10.2:20171103103655:00000000'

+             ]

+ 

+             with mock.patch("sys.argv", cli_cmd):

+                 main()

+                 output = capsys.readouterr()[0]

+ 

+             check_common_output(output)

+             assert "RPMs which dist tag changed" not in output

+             assert "RPMs Reused" not in output

+ 

      def test_cli_dist_option(self, mbs_json_res, capsys):

          """

          Testing option --dist which displays RPMs which changed their dist tag.

... because that's how things work now.

Pull-Request has been merged by ralph

7 years ago
Metadata