예제 #1
0
 def test_error_response(self):
     create_method = mock.MagicMock(
         side_effect=exceptions.AbnormalGithubResponse)
     self.fake_release.return_value = mock.MagicMock(publish=create_method)
     with mock.patch.object(sys, "argv", SHORT_ARGS):
         main()
         create_method.assert_called_with(tag_name=TEST_TAG,
                                          name=TEST_TAG,
                                          body=DEFAULT_RELEASE_MESSAGE)
예제 #2
0
 def test_good_commands(self):
     create_method = mock.MagicMock(
         return_value="http://localhost/tag/testurl")
     self.fake_release.return_value = mock.MagicMock(publish=create_method)
     with mock.patch.object(sys, "argv", SHORT_ARGS):
         main()
         create_method.assert_called_with(tag_name=TEST_TAG,
                                          name=TEST_TAG,
                                          body=DEFAULT_RELEASE_MESSAGE)
예제 #3
0
 def test_quoted_release_message(self):
     release_message = "hello world you see it"
     create_method = mock.MagicMock(
         return_value="http://localhost/tag/testurl")
     self.fake_release.return_value = mock.MagicMock(publish=create_method)
     with mock.patch.object(sys, "argv", SHORT_ARGS + [release_message]):
         main()
         create_method.assert_called_with(tag_name=TEST_TAG,
                                          name=TEST_TAG,
                                          body=release_message)
예제 #4
0
 def test_custom_release_message(self):
     release_message = ["hello", "world", "you", "see", "it"]
     create_method = mock.MagicMock(
         return_value="http://localhost/tag/testurl")
     self.fake_release.return_value = mock.MagicMock(publish=create_method)
     with mock.patch.object(sys, "argv", SHORT_ARGS + release_message):
         main()
         create_method.assert_called_with(
             tag_name=TEST_TAG,
             name=TEST_TAG,
             body=" ".join(release_message),
         )
예제 #5
0
def test_insufficent_args():
    with mock.patch.object(sys, "argv", SHORT_ARGS[:2]):
        main()
예제 #6
0
def test_no_args():
    with mock.patch.object(sys, "argv", []):
        main()
예제 #7
0
 def test_no_gease_file_in_main(self):
     self.fake_expand.return_value = os.path.join("tests")
     with mock.patch.object(sys, "argv", SHORT_ARGS):
         main()
예제 #8
0
 def test_key_error_in_main(self):
     self.fake_expand.return_value = os.path.join("tests", "fixtures",
                                                  "malformed")
     with mock.patch.object(sys, "argv", SHORT_ARGS):
         main()