| 1 |  |  | # -*- coding: utf-8 -*- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | # ----------------------------------------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | # Copyright (c) The Spyder Development Team | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | # | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | # Licensed under the terms of the MIT License | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | # (See LICENSE.txt for details) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | # ----------------------------------------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | """Tests github repo.""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | # Standard library imports | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | import os | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | # Third party imports | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | import pytest | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | # Local imports | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | from loghub.main import create_changelog | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | REPO = 'spyder-ide/loghub' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | TEST_TOKEN = os.environ.get('TEST_TOKEN', '').replace('x', '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | TEST_USER = os.environ.get('TEST_USER', '').replace('x', '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | TEST_PASS = os.environ.get('TEST_CODE', '').replace('x', '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | TEST_MILESTONE = 'test-milestone' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | TEST_TAG = 'v0.1.2' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | NOT_ON_CI = os.environ.get('CIRCLECI') != 'true' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | # --- Tests | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | # ----------------------------------------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | @pytest.mark.skipif(NOT_ON_CI, reason='test on ci server only') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | def test_changelog(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     log = create_changelog( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         repo=REPO, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         token=TEST_TOKEN, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         milestone=TEST_MILESTONE, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         output_format='changelog') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |     expected = '''## Version <RELEASE_VERSION> (2016-12-05) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | ### Issues Closed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | * [Issue 26](https://github.com/spyder-ide/loghub/issues/26) - Test number 2 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | * [Issue 24](https://github.com/spyder-ide/loghub/issues/24) - Issue test | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | In this release 2 issues were closed. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | ### Pull Requests Merged | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | * [PR 25](https://github.com/spyder-ide/loghub/pull/25) - PR: Add tests folder | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | In this release 1 pull request was closed. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | ''' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     print([log]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |     print([expected]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |     assert log == expected | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 57 |  |  | @pytest.mark.skipif(NOT_ON_CI, reason='test on ci server only') | 
            
                                                        
            
                                    
            
            
                | 58 |  |  | def test_changelog_release(): | 
            
                                                        
            
                                    
            
            
                | 59 |  |  |     log = create_changelog( | 
            
                                                        
            
                                    
            
            
                | 60 |  |  |         repo=REPO, | 
            
                                                        
            
                                    
            
            
                | 61 |  |  |         token=TEST_TOKEN, | 
            
                                                        
            
                                    
            
            
                | 62 |  |  |         milestone=TEST_MILESTONE, | 
            
                                                        
            
                                    
            
            
                | 63 |  |  |         output_format='release') | 
            
                                                        
            
                                    
            
            
                | 64 |  |  |     expected = '''## Version <RELEASE_VERSION> (2016-12-05) | 
            
                                                        
            
                                    
            
            
                | 65 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 66 |  |  | ### Issues Closed | 
            
                                                        
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 68 |  |  | * Issue #26 - Test number 2 | 
            
                                                        
            
                                    
            
            
                | 69 |  |  | * Issue #24 - Issue test | 
            
                                                        
            
                                    
            
            
                | 70 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 71 |  |  | In this release 2 issues were closed. | 
            
                                                        
            
                                    
            
            
                | 72 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 73 |  |  | ### Pull Requests Merged | 
            
                                                        
            
                                    
            
            
                | 74 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 75 |  |  | * PR #25 - PR: Add tests folder | 
            
                                                        
            
                                    
            
            
                | 76 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 77 |  |  | In this release 1 pull request was closed. | 
            
                                                        
            
                                    
            
            
                | 78 |  |  | ''' | 
            
                                                        
            
                                    
            
            
                | 79 |  |  |     print([log]) | 
            
                                                        
            
                                    
            
            
                | 80 |  |  |     print([expected]) | 
            
                                                        
            
                                    
            
            
                | 81 |  |  |     assert log == expected | 
            
                                                        
            
                                    
            
            
                | 82 |  |  |  |