-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtest_cli_make.py
More file actions
74 lines (50 loc) · 2.66 KB
/
test_cli_make.py
File metadata and controls
74 lines (50 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import unittest
import cloudinary
from click.testing import CliRunner
from cloudinary_cli.cli import cli
class TestCLIMake(unittest.TestCase):
runner = CliRunner()
def test_cli_make_no_params(self):
result = self.runner.invoke(cli, ["make"])
self.assertEqual(0, result.exit_code)
self.assertIn('Usage:', result.output)
def test_cli_make_list_languages(self):
result = self.runner.invoke(cli, ["make", "-ll"])
self.assertEqual(0, result.exit_code)
self.assertIn('html', result.output)
def test_cli_make_list_templates(self):
result = self.runner.invoke(cli, ["make", "-lt"])
self.assertEqual(0, result.exit_code)
self.assertIn('html', result.output)
self.assertIn('upload widget', result.output)
result = self.runner.invoke(cli, ["make", "python", "-lt"])
self.assertEqual(0, result.exit_code)
self.assertIn('python', result.output)
self.assertIn('upload', result.output)
def test_cli_make_upload_widget(self):
result = self.runner.invoke(cli, ["make", "upload_widget"])
self.assertEqual(0, result.exit_code)
self.assertIn('upload_widget', result.output)
self.assertIn(f"cloudName: '{cloudinary.Config().cloud_name}'", result.output)
def test_cli_make_video_player(self):
result = self.runner.invoke(cli, ["make", "video_player"])
self.assertEqual(0, result.exit_code)
self.assertIn('demo-player', result.output)
def test_cli_make_base_python(self):
result = self.runner.invoke(cli, ["make", "base", "python"])
self.assertEqual(0, result.exit_code)
self.assertIn('cloudinary.config', result.output)
self.assertIn(f'"cloud_name": "{cloudinary.Config().cloud_name}"', result.output)
result = self.runner.invoke(cli, ["make", "python", "base"])
self.assertEqual(0, result.exit_code)
self.assertIn('cloudinary.config', result.output)
self.assertIn(f'"cloud_name": "{cloudinary.Config().cloud_name}"', result.output)
def test_cli_make_python_find_all_empty_folders(self):
result = self.runner.invoke(cli, ["make", "python", "find", "all", "empty", "folders"])
self.assertEqual(0, result.exit_code)
self.assertIn("cloudinary.config", result.output)
self.assertIn(f'"cloud_name": "{cloudinary.Config().cloud_name}"', result.output)
result = self.runner.invoke(cli, ["make", "python", "find_all_empty_folders"])
self.assertEqual(0, result.exit_code)
self.assertIn("cloudinary.config", result.output)
self.assertIn(f'"cloud_name": "{cloudinary.Config().cloud_name}"', result.output)