Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

import logging 

import unittest 

 

import subprocess 

 

from .base import log_info 

from .mixins import ChangelogMixin 

 

__author__ = 'Artur Barseghyan' 

__copyright__ = '2019 Artur Barseghyan' 

__license__ = 'GPL 2.0/LGPL 2.1' 

__all__ = ('TestCommands',) 

 

LOGGER = logging.getLogger(__name__) 

 

 

class TestCommands(unittest.TestCase, ChangelogMixin): 

"""Commands tests.""" 

 

maxDiff = None 

 

@classmethod 

def setUpClass(cls): 

"""Set up.""" 

super(TestCommands, cls).setUpClass() 

cls.prepare_changelog_data() 

 

@log_info 

def test_generate_changelog(self): 

"""Test generate changelog command.""" 

res = subprocess.check_output([ 

'generate-changelog', 

'--no-other' 

]).strip().decode() 

self.assertEqual(res, self.no_args_out) 

return res 

 

@log_info 

def test_generate_changelog_show_releases(self): 

"""Test generate changelog command.""" 

res = subprocess.check_output([ 

'generate-changelog', 

'--show-releases', 

'--no-other' 

]).strip().decode() 

self.assertEqual(res, self.show_releases_out) 

return res 

 

@log_info 

def test_generate_changelog_show_releases_latest_release(self): 

"""Test generate changelog command.""" 

res = subprocess.check_output([ 

'generate-changelog', 

'--show-releases', 

'--latest-release', 

'--no-other' 

]).strip().decode() 

self.assertEqual( 

res, 

self.latest_release_show_releases_out 

) 

return res 

 

@log_info 

def test_generate_changelog_show_releases_headings_only(self): 

"""Test generate changelog command.""" 

res = subprocess.check_output([ 

'generate-changelog', 

'--show-releases', 

'--headings-only', 

'--no-other' 

]).strip().decode() 

self.assertEqual( 

res, 

self.show_releases_headings_only_out 

) 

return res 

 

@log_info 

def test_generate_changelog_headings_only(self): 

"""Test generate changelog command.""" 

res = subprocess.check_output([ 

'generate-changelog', 

'--headings-only', 

'--no-other' 

]).strip().decode() 

self.assertEqual( 

res, 

self.headings_only_out 

) 

return res 

 

@log_info 

def test_json_changelog_command(self): 

"""Test json changelog command.""" 

res = subprocess.check_output([ 

'json-changelog' 

]).strip().decode() 

self.assertEqual(res, self.json_no_args_out) 

return res 

 

@log_info 

def test_json_changelog_command_show_releases(self): 

"""Test json changelog command.""" 

res = subprocess.check_output([ 

'json-changelog', 

'--show-releases' 

]).strip().decode() 

self.assertEqual(res, self.json_show_releases_out) 

return res 

 

@log_info 

def test_json_changelog_show_releases_latest_release(self): 

"""Test json changelog command.""" 

res = subprocess.check_output([ 

'json-changelog', 

'--show-releases', 

'--latest-release' 

]).strip().decode() 

self.assertEqual( 

res, 

self.json_latest_release_show_releases_out 

) 

return res 

 

@log_info 

def test_json_changelog_show_releases_headings_only(self): 

"""Test json changelog command.""" 

res = subprocess.check_output([ 

'json-changelog', 

'--show-releases', 

'--headings-only' 

]).strip().decode() 

self.assertEqual( 

res, 

self.json_show_releases_headings_only_out 

) 

return res 

 

@log_info 

def test_json_changelog_headings_only(self): 

"""Test json changelog command.""" 

res = subprocess.check_output([ 

'json-changelog', 

'--headings-only' 

]).strip().decode() 

self.assertEqual( 

res, 

self.json_headings_only_out 

) 

return res 

 

@log_info 

def test_make_config_file(self): 

"""Test make config command.""" 

res = subprocess.check_output([ 

'matyan-make-config', 

]).strip().decode() 

self.assertEqual(res, '') 

return res 

 

 

if __name__ == '__main__': 

unittest.main()