|
6 | 6 | import orlo.exceptions |
7 | 7 | import orlo.stats |
8 | 8 | from time import sleep |
| 9 | +import sqlalchemy.orm |
9 | 10 |
|
10 | 11 | __author__ = 'alforbes' |
11 | 12 |
|
@@ -183,6 +184,13 @@ def test_package_summary(self): |
183 | 184 | self.assertIn('packageOne', packages) |
184 | 185 | self.assertIn('packageTwo', packages) |
185 | 186 |
|
| 187 | + def test_package_summary_returns_query(self): |
| 188 | + rid1 = self._create_release() |
| 189 | + self._create_package(rid1, name='packageOne') |
| 190 | + |
| 191 | + result = orlo.queries.package_summary() |
| 192 | + self.assertIsInstance(result, sqlalchemy.orm.query.Query) |
| 193 | + |
186 | 194 | def test_package_summary_with_platform(self): |
187 | 195 | """ |
188 | 196 | Test package_summary |
@@ -320,20 +328,40 @@ def test_package_versions_with_rollback(self): |
320 | 328 | self.assertIn(('packageOne', '1.0.1'), versions) |
321 | 329 |
|
322 | 330 |
|
| 331 | +class TestInfo(OrloQueryTest): |
| 332 | + """ |
| 333 | + Test the _info functions |
| 334 | + """ |
| 335 | + |
| 336 | + def _create_test_package(self): |
| 337 | + rid = self._create_release(platforms=['platformOne']) |
| 338 | + pid = self._create_package(rid, name='packageOne', version='1.0.1') |
| 339 | + return pid |
| 340 | + |
| 341 | + def test_returns_query(self): |
| 342 | + """ |
| 343 | + Assert that package_info should return a query |
| 344 | + """ |
| 345 | + self._create_test_package() |
| 346 | + result = orlo.queries.package_info('packageOne') |
| 347 | + self.assertIsInstance(result, sqlalchemy.orm.query.Query) |
| 348 | + |
| 349 | + |
323 | 350 | class TestCountReleases(OrloQueryTest): |
324 | 351 | """ |
325 | 352 | Parent class for testing the CountReleases function |
326 | 353 |
|
327 | | - By subclassing it and overriding ARGS, we can test different combinations of arguments |
328 | | - with the same test code. |
| 354 | + By subclassing it and overriding ARGS, we can test different combinations of |
| 355 | + arguments with the same test code. |
329 | 356 |
|
330 | | - INCLUSIVE_ARGS represents a set of arguments that will match the releases created (see |
331 | | - the functions in OrloQueryTest for what those are) |
332 | | - EXCLUSIVE_ARGS represents a set of arguments that will not match any releases created, |
333 | | - i.e. should return a count of zero |
| 357 | + INCLUSIVE_ARGS represents a set of arguments that will match the releases |
| 358 | + created (see the functions in OrloQueryTest for what those are) |
| 359 | + EXCLUSIVE_ARGS represents a set of arguments that will not match any |
| 360 | + releases created, i.e. should return a count of zero |
334 | 361 |
|
335 | | - This parent class has tests that should be the same result no matter what the arguments |
336 | | - (except the exclusive case which must always a count of zero so we define it here) |
| 362 | + This parent class has tests that should be the same result no matter what |
| 363 | + the arguments (except the exclusive case which must always a count of zero |
| 364 | + so we define it here) |
337 | 365 | """ |
338 | 366 |
|
339 | 367 | INCLUSIVE_ARGS = {} # Args we are testing, result should include these |
|
0 commit comments