Esempio n. 1
0
 def test_merge_swagger_error(self):
     arguments = [
         "merge-swagger",
     ]
     cmd = Command(arguments=arguments, autorun=False)
     with pytest.raises(ResolutionError) as excinfo:
         cmd.run()
Esempio n. 2
0
 def test_startproject_error(self):
     arguments = ["startproject"]
     cmd = Command(arguments=arguments, autorun=False)
     with pytest.raises(PackageNotExists) as excinfo:
         cmd.run()
     assert "cookiecutter is not installed. try with pip install -U cookiecutter" in str(
         excinfo.value)
Esempio n. 3
0
 def test_crypt_file_ok(self):
     crypt = Crypt()
     crypt.generate_key("mypassword", True)
     arguments = ["encrypt", "prueba"]
     cmd = Command(arguments=arguments, autorun=False)
     cmd.run()
     crypt.delete_key()
Esempio n. 4
0
 def test_create_config_all(self, input):
     # Remove config file if already exists for test
     remove_conf_file()
     arguments = ["create-config"]
     cmd = Command(arguments=arguments, autorun=False)
     assert cmd.run()
     assert not cmd.run()
     remove_conf_file()
Esempio n. 5
0
 def test_generate_file_ok(self, input):
     crypt = Crypt()
     arguments = [
         "create-key",
     ]
     cmd = Command(arguments=arguments, autorun=False)
     cmd.run()
     crypt.delete_key()
Esempio n. 6
0
 def test_crypt_file_error(self):
     arguments = ["encrypt", "prueba"]
     cmd = Command(arguments=arguments, autorun=False)
     with pytest.raises(FileDoesNotExistException) as excinfo:
         cmd.run()
     assert (
         "Decrypt key None not exists. You must set a correct env var PYMS_KEY_FILE or run "
         "`pyms crypt create-key` command") in str(excinfo.value)
Esempio n. 7
0
 def test_output_key(self, input):
     crypt = Crypt()
     arguments = ["create-key", ]
     cmd = Command(arguments=arguments, autorun=False)
     cmd.run()
     with pytest.raises(FileNotFoundError) as excinfo:
         crypt.delete_key()
     assert "[Errno 2] No such file or directory: 'key.key'" in str(excinfo.value)
Esempio n. 8
0
 def test_merge_swagger_ok(self):
     arguments = [
         "merge-swagger",
         "--file",
         "tests/swagger_for_tests/swagger.yaml",
     ]
     cmd = Command(arguments=arguments, autorun=False)
     assert cmd.run()
     os.remove("tests/swagger_for_tests/swagger-complete.yaml")
Esempio n. 9
0
 def test_merge_swagger_error(self):
     arguments = ["merge-swagger", ]
     cmd = Command(arguments=arguments, autorun=False)
     assert not cmd.run()