IEEE.org     |     IEEE Xplore Digital Library     |     IEEE Standards     |     IEEE Spectrum     |     More Sites

Verified Commit a170a04c authored by Emi Simpson's avatar Emi Simpson
Browse files

[new arch] Test GetSources

parent f7508365
......@@ -340,3 +340,28 @@ class TestQueries(unittest.TestCase):
Exception,
delete_proj.handle_results,
SqlIntegrityError(SqlErrorCode.BAD_NULL_ERROR, 'unexpected'))
def test_get_sources(self):
get_sources = GetSources(ProjectID(UncheckedPID(1312)))
self.assertEqual(
get_sources.get_query(),
QueryRequest('''
SELECT source_id, data_type, data_url, flagged
FROM data_sources
WHERE project_id = %s;
''', (1312,)))
self.assertEqual(
get_sources.handle_results(QueryResult(2, 11, *next_and_all([
(10, 'github', 'https://github.com/spacekookie/gay', False),
(11, 'git', 'https://github.com/rust-cli/confy', True),
]))),
Finished([
Source(10, None, 'github', 'https://github.com/spacekookie/gay', False),
Source(11, None, 'git', 'https://github.com/rust-cli/confy', True)]))
self.assertEqual(
get_sources.handle_results(none_result),
Finished([]))
self.assertRaises(
Exception,
get_sources.handle_results,
SqlIntegrityError(SqlErrorCode.BAD_NULL_ERROR, 'unexpected'))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment