(self)
| 108 | ) |
| 109 | |
| 110 | def test_download(self): |
| 111 | |
| 112 | obj, data = self._get_detection_obj_data(self.url % '') |
| 113 | self.assertEqual(data, self.expected_data) |
| 114 | |
| 115 | if not EXTRA_DOWNLOAD: |
| 116 | return |
| 117 | |
| 118 | # Normal ASCII file |
| 119 | readable_file = '/etc/resolv.conf' |
| 120 | content = open(readable_file, 'r').read() |
| 121 | self.assertEqual(content, obj.read(readable_file)) |
| 122 | |
| 123 | # Long binary file |
| 124 | readable_file = '/bin/ls' |
| 125 | content = open(readable_file, 'rb').read() |
| 126 | self.assertEqual(content, obj.read(readable_file)) |
| 127 | |
| 128 | # Non existant file |
| 129 | self.assertEqual(None, obj.read('/nonexistant')) |
| 130 | # Unpermitted file |
| 131 | self.assertEqual(None, obj.read('/etc/shadow')) |
| 132 | # Empty file |
| 133 | self.assertEqual('', obj.read('/dev/null')) |
| 134 | |
| 135 | def test_upload(self): |
| 136 |
nothing calls this directly
no test coverage detected