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

Verified Commit 7fa1a3d8 authored by Emi Simpson's avatar Emi Simpson
Browse files

[new arch] Test AddSourceToProject

parent 0a60762a
......@@ -189,3 +189,30 @@ class TestQueries(unittest.TestCase):
Exception,
retreive_info.handle_results,
SqlIntegrityError(SqlErrorCode.BAD_NULL_ERROR, 'unexpected error'))
def test_add_source_to_project(self):
retreive_info = AddSourceToProject(ProjectID(UncheckedPID(1312)),'github', 'https://github.com/MyUser/MyProj')
self.assertEqual(
retreive_info.get_query(),
QueryRequest('''
INSERT INTO data_sources (
data_type,
data_url,
project_id
)
VALUES (%s, %s, %s);
''',
('github', 'https://github.com/MyUser/MyProj', 1312)))
self.assertEqual(
retreive_info.handle_results(QueryResult(1, 100, panic, panic)),
Finished(100))
self.assertEqual(
retreive_info.handle_results(SqlIntegrityError(SqlErrorCode.NO_REFERENCED_ROW, '')),
Error(AddSourceError.NonexistantProject))
self.assertEqual(
retreive_info.handle_results(SqlIntegrityError(SqlErrorCode.DUP_ENTRY, '')),
Error(AddSourceError.SourceAlreadyPresent))
self.assertRaises(
Exception,
retreive_info.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